@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');

:root {
    --brand-gold: #B9975B;
    --coffee-dark: #2E1B0F;
    --coffee-mid: #5A3A23;
    --glass: rgba(30, 20, 12, 0.75);
    --white: #ffffff;
    --gray-light: #f5f5f5;
    --error-red: #dc3545;
    --success-green: #28a745;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(185, 151, 91, 0.28);
}

.login-container {
    display: flex;
    height: 100vh;
    width: 100%;
    background: 
        linear-gradient(135deg, rgba(46, 27, 15, 0.8) 0%, rgba(90, 58, 35, 0.6) 50%, rgba(185, 151, 91, 0.4) 100%),
        url('/img/loginBack.png') center/cover no-repeat;
    position: relative;
    overflow: hidden;
}

.login-background {
    display: none;
}





.login-form-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: transparent;
    position: relative;
    z-index: 10;
}

.login-card {
    background: rgba(30, 20, 12, 0.85);
    backdrop-filter: blur(15px);
    border-radius: 25px;
    padding: 3.5rem;
    width: 100%;
    max-width: 480px;
    border: 2px solid rgba(185, 151, 91, 0.4);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(185, 151, 91, 0.1);
    position: relative;
    overflow: hidden;
}

.language-switch {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--brand-gold);
    color: var(--brand-gold);
    min-height: 44px;
    padding: 0.55rem 1.1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    touch-action: manipulation;
}

.lang-btn.active {
    background: var(--brand-gold);
    color: var(--white);
}

.lang-btn:hover {
    background: var(--brand-gold);
    color: var(--white);
}

.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    width: 220px;
    height: auto;
}

.form-group {
    margin-bottom: 1.2rem;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--white);
    font-weight: 500;
    font-size: 0.85rem;
}

.form-group input,
.form-group select {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid rgba(185, 151, 91, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    /* ≥16px يقلّل تكبير Safari على آيفون عند التركيز */
    font-size: max(1rem, 16px);
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

.form-group select {
    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='%23B9975B' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--brand-gold);
    background: rgba(255, 255, 255, 0.15);
}

.form-group select option {
    background: var(--coffee-dark);
    color: var(--white);
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-gold);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.password-toggle-btn {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    color: var(--brand-gold);
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
}

.password-toggle-btn:hover {
    color: #fff;
}

.password-toggle-btn svg {
    width: 18px;
    height: 18px;
}

[dir="ltr"] .password-toggle-btn {
    left: auto;
    right: 0.5rem;
}

.form-group select + .input-icon {
    margin-top: 0.4rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.remember-me input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.remember-me label {
    color: var(--white);
    font-size: 0.9rem;
    margin: 0;
}

.login-btn {
    width: 100%;
    min-height: 52px;
    padding: 1rem;
    background: var(--brand-gold);
    color: var(--white);
    border: none;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

.login-btn:hover {
    background: #9a7d4a;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(185, 151, 91, 0.4);
}

.forgot-password {
    text-align: center;
}

.forgot-password a {
    color: var(--brand-gold);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.forgot-password a:hover {
    color: #9a7d4a;
}

.error-message {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid var(--error-red);
    color: var(--error-red);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.location-hint {
    background: rgba(255, 193, 7, 0.18);
    border: 1px solid rgba(200, 150, 40, 0.65);
    color: #5c4a1a;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.88rem;
    line-height: 1.45;
}

.success-message {
    background: rgba(40, 167, 69, 0.2);
    border: 1px solid var(--success-green);
    color: var(--success-green);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* RTL Support */
[dir="ltr"] .input-icon {
    left: auto;
    right: 1rem;
}

[dir="ltr"] .form-group input,
[dir="ltr"] .form-group select {
    padding: 1rem 3rem 1rem 1rem;
}

[dir="ltr"] .language-switch {
    right: auto;
    left: 1rem;
}

.forgot-password a:hover {
    color: var(--brand-gold);
}

.settings-entry-link-wrap {
    margin-top: 1rem;
    text-align: center;
}

.settings-entry-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(185, 151, 91, 0.45);
    transition: all 0.2s ease;
}

.settings-entry-link:hover {
    color: #fff;
    background: rgba(185, 151, 91, 0.15);
    border-color: var(--brand-gold);
}

/* Media Queries */
@media (max-width: 991px) {
    .login-form-container {
        flex: 1;
        background: linear-gradient(135deg, var(--coffee-dark) 0%, var(--coffee-mid) 100%);
    }
    
    .login-card {
        max-width: 100%;
        margin: 0 1rem;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.5rem;
    }
    
    .title-en {
        font-size: 1.5rem;
    }
    
    .title-ar {
        font-size: 1.2rem;
    }
}
