/* =========================
   SECURITY PAGE (Login & Register)
   FINAL VERSION - WITH WRAPPER FIX
   ========================= */

/* --- Základní rozvržení stránky --- */
.security-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--HM-body-bg, #111827);
    padding: 1.25rem 0;
}

.security-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: var(--HM-card-bg, #1f2937);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* --- Levá strana (Obrázek/Info) --- */
.security-image-side {
    background: linear-gradient(135deg, var(--HM-primary, #f97316) 0%, var(--HM-primary-hover, #ea580c) 100%);
    color: white;
    padding: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 600px;
}

.security-image-content {
    text-align: center;
}

.security-logo i {
    color: white;
    opacity: 0.9;
}

.security-logo h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.security-logo p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.security-features {
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.security-feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.security-feature-item i {
    font-size: 1.5rem;
    opacity: 0.9;
}

/* --- Pravá strana (Formulář) --- */
.security-form-side {
    padding: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--HM-card-bg, #1f2937);
}

.security-form-content {
    width: 100%;
    max-width: 450px;
}

.security-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.security-header h1 {
    color: var(--HM-text, #f9fafb);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.security-header p {
    color: var(--HM-text-muted, #9ca3af);
    font-size: 1rem;
}

/* =========================
   FORMULÁŘOVÉ PRVKY
   ========================= */

.security-form {
    margin-bottom: 1.5rem;
}

/* 1. MEZERY A GRID */
.security-form > .form-floating,
.security-form > .row,
.security-form > .security-grid-2,
.security-form > .agree-terms-row,
.security-form .mb-3,
.security-form .mb-4 {
    margin-bottom: 0.65rem !important;
}

.security-form .row .form-floating,
.security-form .security-grid-2 .form-floating {
    margin-bottom: 0 !important;
}

.security-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 768px) {
    .security-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.security-form .row.g-3 {
    --bs-gutter-y: 0.65rem;
    --bs-gutter-x: 1rem;
}

/* 2. STATICKÝ LABEL */
.security-form .form-floating {
    display: block;
    min-height: auto;
    position: relative;
}

.security-form .form-floating > label {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 0 0.25rem 0 !important;
    width: 100%;
    border: none !important;

    color: var(--HM-text-muted, #9ca3af);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    background: transparent !important;
}

.security-form .form-floating > label::after {
    display: none !important;
    content: none !important;
}

.security-form .form-floating > label i {
    color: var(--HM-primary, #f97316);
    width: 20px;
    text-align: center;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

/* --- NOVÝ WRAPPER PRO INPUT A IKONKU --- */
/* Toto je klíčové pro správné centrování - rodič má výšku jen jako input */
.security-input-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

/* 3. INPUTY A SELECTY */
.security-form .security-input,
.security-form .form-select.security-input,
.security-form select.security-input {
    display: block;
    width: 100%;
    border: 2px solid var(--HM-border, #374151) !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.875rem !important;

    background-color: var(--HM-card-bg, #1f2937) !important;
    color: var(--HM-text, #f9fafb) !important;

    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.5;
    transition: all 0.3s ease;

    height: 40px !important;
    min-height: 40px !important;
}

.security-form .security-input:focus,
.security-form .form-select.security-input:focus,
.security-form select.security-input:focus {
    border-color: var(--HM-primary, #f97316) !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12) !important;
    outline: none;
    background-color: var(--HM-card-bg, #1f2937) !important;
}

.security-form .security-input::placeholder {
    color: var(--HM-text-muted, #6b7280);
    opacity: 0.7;
}

/* Browser autofill override - must beat Chrome's internal UA styles */
.security-form .security-input:-webkit-autofill,
.security-form .security-input:-webkit-autofill:hover,
.security-form .security-input:-webkit-autofill:focus,
.security-form .security-input:-webkit-autofill:active,
.security-form input.security-input:-webkit-autofill,
.security-form input.security-input:-webkit-autofill:hover,
.security-form input.security-input:-webkit-autofill:focus,
.security-form input.security-input:-webkit-autofill:active {
    -webkit-box-shadow: inset 0 0 0 40px var(--HM-card-bg, #1f2937) !important;
    box-shadow: inset 0 0 0 40px var(--HM-card-bg, #1f2937) !important;
    -webkit-text-fill-color: var(--HM-text, #f9fafb) !important;
    border: 2px solid var(--HM-border, #374151) !important;
    border-radius: 8px !important;
    background-color: var(--HM-card-bg, #1f2937) !important;
    color: var(--HM-text, #f9fafb) !important;
    height: 40px !important;
    min-height: 40px !important;
    outline: none !important;
}

/* Autofill + focus: keep border grey, only add subtle orange glow */
.security-form .security-input:-webkit-autofill:focus,
.security-form input.security-input:-webkit-autofill:focus {
    border-color: var(--HM-border, #374151) !important;
    box-shadow: inset 0 0 0 40px var(--HM-card-bg, #1f2937), 0 0 0 3px rgba(249, 115, 22, 0.12) !important;
    -webkit-box-shadow: inset 0 0 0 40px var(--HM-card-bg, #1f2937) !important;
}

/* Firefox autofill */
.security-form .security-input:-moz-placeholder-shown,
.security-form .security-input:autofill {
    background-color: var(--HM-card-bg, #1f2937) !important;
    color: var(--HM-text, #f9fafb) !important;
    border: 2px solid var(--HM-border, #374151) !important;
}

/* Select Specifika */
.security-form select.security-input,
.security-form .form-select.security-input {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 12px !important;
    padding-right: 2.5rem !important;
}

.security-form select.security-input option,
.security-form .form-select.security-input option {
    background-color: var(--HM-card-bg, #1f2937);
    color: var(--HM-text, #f9fafb);
    padding: 8px;
    border-bottom: 1px solid var(--HM-border, #374151);
}

.security-form select.security-input {
    scrollbar-width: thin;
    scrollbar-color: var(--HM-primary, #f97316) var(--HM-card-bg, #1f2937);
}

/* --- DATE INPUT (ŠEDÁ IKONA) --- */
.security-form .security-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(70%) sepia(10%) saturate(529%) hue-rotate(177deg) brightness(91%) contrast(87%);
    opacity: 0.8;
    transition: opacity 0.2s;
    margin-left: auto;
}

.security-form .security-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* --- PASSWORD TOGGLE (OKO) --- */
/* Protože je uvnitř .security-input-wrapper (který má výšku inputu),
   top: 50% bude fungovat přesně na střed inputu. */
.security-form .password-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
    background: transparent !important; /* Žádné pozadí */
    border-radius: 50%;
    color: var(--HM-text-muted, #9ca3af);
    transition: color 0.2s ease;
}

.security-form .password-toggle:hover {
    color: var(--HM-primary, #f97316);
    /* Pokud chcete jemné podbarvení při hoveru, odkomentujte níže: */
    /* background-color: rgba(249, 115, 22, 0.1) !important; */
}

.security-form .password-toggle i {
    font-size: 1rem;
    line-height: 1;
}

/* Padding vpravo pro input, aby text nešel přes ikonku */
/* Nyní cílíme na input uvnitř wrapperu */
.security-input-wrapper .security-input {
    padding-right: 4.5rem !important;
}

/* --- CHECKBOX --- */
.security-form .agree-terms-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 0;
    min-height: 24px;
}

.security-form .security-check {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--HM-border, #374151);
    border-radius: 4px;
    background: var(--HM-card-bg, #1f2937);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    margin: 0;
}

.security-form .security-check:checked {
    background: var(--HM-primary, #f97316);
    border-color: var(--HM-primary, #f97316);
}

.security-form .security-check:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 11px;
}

.security-form .form-check-label {
    color: var(--HM-text, #f9fafb);
    font-size: 0.9rem;
    cursor: pointer;
    margin: 0;
    line-height: 1.2;
}

/* =========================
   BUTTONS & LINKS
   ========================= */

/* Submit Button */
.security-form .btn-primary {
    height: 48px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--HM-primary, #f97316), var(--HM-primary-hover, #ea580c));
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.security-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(211, 47, 47, 0.3);
}

/* Create Account Button (Outline Orange) */
.security-links .btn-outline-primary {
    color: var(--HM-primary, #f97316) !important;
    border: 2px solid var(--HM-primary, #f97316) !important;
    background-color: transparent !important;
    height: 50px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-bottom: 0.5rem;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.security-links .btn-outline-primary:hover,
.security-links .btn-outline-primary:focus,
.security-links .btn-outline-primary:active {
    background-color: var(--HM-primary, #f97316) !important;
    color: white !important;
    border-color: var(--HM-primary, #f97316) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(249, 115, 22, 0.25);
}

/* Divider */
.security-divider {
    text-align: center;
    position: relative;
    margin: 1.5rem 0;
}

.security-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--HM-border, #374151);
}

.security-divider span {
    position: relative;
    background: var(--HM-card-bg, #1f2937);
    padding: 0 1rem;
    color: var(--HM-text-muted, #9ca3af);
    font-size: 0.9rem;
}

/* Links */
.security-links a.text-muted,
.text-center a.text-muted {
    color: var(--HM-text-muted, #9ca3af) !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

.security-links a.text-muted:hover,
.text-center a.text-muted:hover {
    color: var(--HM-text, #f9fafb) !important;
}

/* =========================
   PASSWORD RESET EXTRAS
   ========================= */

/* Info box (blue hint under header) */
.security-info-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: var(--HM-text, #f9fafb);
    font-size: 0.88rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.security-info-box i {
    color: #60a5fa;
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.security-info-box span {
    flex: 1;
    min-width: 0;
}

/* Alert boxes (flash messages) */
.security-alert {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.security-alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.security-alert-success i {
    color: #34d399;
    flex-shrink: 0;
}

.security-alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.security-alert-error i {
    color: #f87171;
    flex-shrink: 0;
}

/* Validation borders on inputs */
.security-input.is-valid {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
}

.security-input.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

/* Symfony form_errors output styling */
.security-form .form-errors {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0 0;
}

.security-form .form-errors li {
    color: #f87171;
    font-size: 0.82rem;
    padding: 0.25rem 0;
}

/* Feedback row: strength bar on the left, match text on the right */
.security-feedback-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.security-strength {
    flex: 1;
}

.security-match {
    flex: 1;
    text-align: right;
}

/* Strength meter bar */
.strength-meter {
    height: 5px;
    background: var(--HM-border, #374151);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.2rem;
}

.strength-meter .strength-bar {
    height: 100%;
    width: 0;
    transition: width 0.25s ease, background-color 0.25s ease;
}

.strength-meter.strength-0 .strength-bar { width: 15%; background: #ef4444; }
.strength-meter.strength-1 .strength-bar { width: 35%; background: #f59e0b; }
.strength-meter.strength-2 .strength-bar { width: 60%; background: #fbbf24; }
.strength-meter.strength-3 .strength-bar { width: 80%; background: #10b981; }
.strength-meter.strength-4 .strength-bar { width: 100%; background: #059669; }

.strength-text {
    color: var(--HM-text-muted, #9ca3af);
    font-size: 0.8rem;
}

/* Match indicator text */
.match-text {
    font-size: 0.8rem;
    font-weight: 600;
}

.match-text.match    { color: #10b981; }
.match-text.no-match { color: #ef4444; }

/* Loading state on submit button */
.security-form .btn-primary {
    position: relative;
    overflow: hidden;
}

.security-form .btn-primary .btn-text {
    position: relative;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.security-form .btn-primary .btn-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.security-form .btn-primary.loading .btn-text  { opacity: 0; }
.security-form .btn-primary.loading .btn-loader { opacity: 1; }

/* Stack strength / match on very small screens */
@media (max-width: 420px) {
    .security-feedback-row {
        flex-direction: column;
        gap: 0.35rem;
    }
    .security-match {
        text-align: left;
    }
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 992px) {
    .security-image-side {
        min-height: auto;
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .security-container {
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
        margin: 0;
    }

    .security-page {
        padding: 0;
        align-items: stretch;
    }

    .security-image-side {
        display: none;
    }

    .security-form-side {
        padding: 2rem 1.5rem;
        min-height: 100vh;
    }

    .security-form-content {
        max-width: 100%;
    }
}