/* auth.css */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(8, 10, 18, 0.82);
    backdrop-filter: blur(12px);
    animation: none;
}

.modal-content {
    background: linear-gradient(180deg, rgba(35, 41, 58, 0.98) 0%, rgba(20, 25, 37, 0.98) 100%);
    margin: 0 auto;
    padding: 24px;
    border-radius: 18px;
    width: 90%;
    max-width: 380px;
    position: relative;
    border: 1px solid rgba(255, 223, 143, 0.22);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.32);
    animation: none;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content h3 {
    color: #ffdf8f;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.6em;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(255, 223, 143, 0.5);
}

.close {
    position: absolute;
    top: 12px;
    right: 16px;
    color: #ffdf8f;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.close:hover {
    color: #fff;
    background: rgba(255, 223, 143, 0.1);
    transform: rotate(90deg);
}

#login-form, #register-form, #change-password-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#login-form input, #register-form input, #change-password-form input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(33, 39, 56, 0.92);
    border: 1px solid rgba(126, 136, 164, 0.24);
    border-radius: 12px;
    color: #fff9e7;
    font-size: 14px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

#login-form input::placeholder, #register-form input::placeholder, #change-password-form input::placeholder {
    color: #8a8fa3;
}

#login-form input:focus, #register-form input:focus, #change-password-form input:focus {
    outline: none;
    border-color: #ffdf8f;
    box-shadow: 0 0 0 4px rgba(255, 223, 143, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    background: rgba(37, 44, 62, 0.94);
}

#login-form button, #register-form button, #change-password-form button {
    padding: 12px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    margin-top: 8px;
}

#login-form button {
    background: linear-gradient(180deg, #ffe7a8, #e7c66f);
    color: #181c29;
    box-shadow: 0 16px 28px rgba(231, 198, 111, 0.22);
}

#login-form button:hover {
    background: linear-gradient(145deg, #ffe6a8, #f0d58a);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 223, 143, 0.5);
}

#change-password-form button {
    background: linear-gradient(180deg, #7ac7ff, #4a92dd);
    color: white;
    box-shadow: 0 16px 28px rgba(74, 146, 221, 0.2);
}

#change-password-form button:hover {
    background: linear-gradient(145deg, #89d2ff, #5aa1eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(90, 161, 235, 0.45);
}

#login-error, #register-error, #change-password-error {
    background: linear-gradient(145deg, #dc3545, #c82333);
    color: white;
    padding: 10px 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    margin-top: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 3px 12px rgba(220, 53, 69, 0.3);
    animation: shake 0.5s ease;
}

:is(#change-password-error, #change-password-error-dropdown).success-message {
    color: #ffdf8f;
    background: linear-gradient(145deg, rgba(255, 223, 143, 0.15), rgba(255, 223, 143, 0.05));
    border: 1px solid rgba(255, 223, 143, 0.3);
    box-shadow: 0 3px 12px rgba(255, 223, 143, 0.12);
    animation: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 223, 143, 0.2);
}

.auth-switch p {
    color: #8a8fa3;
    margin: 0;
    font-size: 13px;
}

.auth-switch a {
    color: #ffdf8f;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-switch a:hover {
    color: #ffe6a8;
    text-decoration: underline;
}

.status-icon { font-size: 1em; }
.status-online { color: #4CAF50; }
.status-offline { color: #dc3545; }
.status-busy { color: #ff9800; }

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid transparent;
    border-top: 2px solid #ffdf8f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .modal-content { margin: 0 auto; padding: 20px; width: 95%; }
    .modal-content h3 { font-size: 1.4em; }
    #login-form input, #register-form input, #change-password-form input { padding: 10px 12px; font-size: 13px; }
    #login-form button, #register-form button, #change-password-form button { padding: 10px; font-size: 13px; }
}

@media (max-width: 480px) {
    .modal-content { margin: 0 auto; padding: 16px; border-radius: 12px; }
    .modal-content h3 { font-size: 1.2em; }
    .close { top: 8px; right: 12px; font-size: 20px; }
    #login-form, #register-form, #change-password-form { gap: 12px; }
}

.user-info { animation: fadeInScale 0.3s ease; }

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.user-role.super_admin { background: linear-gradient(145deg, #ff6b6b, #c82333); color: white; }
.user-role.admin { background: linear-gradient(145deg, #667eea, #764ba2); color: white; }
.user-role.user_plus { background: linear-gradient(145deg, #4CAF50, #45a049); color: white; }
.user-role.user { background: linear-gradient(145deg, #6c757d, #5a6268); color: white; }

.user-role.moderator { background: linear-gradient(145deg, #ff9800, #f57c00); color: white; }
.user-role.premium { background: linear-gradient(145deg, #9c27b0, #7b1fa2); color: white; }

.profile-modal-content {
    max-width: 420px;
}

.profile-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 223, 143, 0.08);
    border: 1px solid rgba(255, 223, 143, 0.14);
}

.profile-summary-label {
    color: #aeb5c5;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.profile-summary-value {
    color: #fff9e7;
    font-size: 20px;
    font-weight: 700;
    word-break: break-word;
}

.profile-role-badge {
    width: fit-content;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    background: linear-gradient(145deg, #6c757d, #5a6268);
}

.profile-role-badge.super_admin { background: linear-gradient(145deg, #ff6b6b, #c82333); }
.profile-role-badge.admin { background: linear-gradient(145deg, #667eea, #764ba2); }
.profile-role-badge.user_plus { background: linear-gradient(145deg, #4CAF50, #45a049); }
.profile-role-badge.user { background: linear-gradient(145deg, #6c757d, #5a6268); }
.profile-role-badge.cs_player { background: linear-gradient(145deg, #4f86c6, #35679f); }
.profile-role-badge.cs_player_plus { background: linear-gradient(145deg, #2bb6a8, #1d8f84); }

.profile-actions {
    margin-top: 16px;
}

.profile-logout-btn {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255, 223, 143, 0.18);
    border-radius: 8px;
    background: #121d2a;
    color: #c6c4c0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-logout-btn:hover {
    background: rgba(255, 200, 80, 0.06);
    border-color: rgba(255, 223, 143, 0.2);
    color: #ffd56a;
    box-shadow: none;
    transform: none;
}

/* Shared login and registration modal design. */
:is(#login-modal, #register-modal) {
    --auth-page-bg: #07111C;
    --auth-modal-bg: #0C1624;
    --auth-input-bg: #202B3F;
    --auth-input-hover: #263349;
    --auth-input-border: #3A465D;
    --auth-gold: #F3C95D;
    --auth-gold-light: #FFE08A;
    --auth-gold-dark: #B88A32;
    --auth-text: #F3F5F7;
    --auth-text-secondary: #AAB4C8;
    --auth-placeholder: #9CA8BD;
    --auth-text-subtle: #69758A;
    background-color: rgba(7, 17, 28, 0.88);
}

:is(#login-modal, #register-modal) .modal-content {
    width: min(380px, calc(100% - 32px));
    max-width: 380px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 24px;
    border: 1px solid rgba(211, 169, 73, 0.45);
    border-radius: 20px;
    background: rgba(10, 20, 33, 0.94) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 30px rgba(207, 160, 55, 0.06);
}

:is(#login-modal, #register-modal) .modal-content h3 {
    margin: 8px 28px 20px;
    color: var(--auth-gold-light);
    font-size: 24px;
    line-height: 1.15;
    letter-spacing: 0;
    text-shadow: 0 0 12px rgba(243, 201, 93, 0.22);
}

:is(#login-modal, #register-modal) .close {
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--auth-gold-light);
    font: 700 24px/1 Arial, sans-serif;
}

:is(#login-modal, #register-modal) .close:focus-visible,
:is(#login-modal, #register-modal) .auth-switch__action:focus-visible {
    outline: 2px solid var(--auth-gold);
    outline-offset: 3px;
}

:is(#login-modal, #register-modal) :is(#login-form, #register-form) {
    gap: 12px;
}

:is(#login-modal, #register-modal) :is(#login-form, #register-form) input {
    box-sizing: border-box;
    height: 42px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--auth-input-border);
    border-radius: 11px;
    background: var(--auth-input-bg);
    color: var(--auth-text);
    font-size: 14px;
}

:is(#login-modal, #register-modal) :is(#login-form, #register-form) input:hover {
    background: var(--auth-input-hover);
}

:is(#login-modal, #register-modal) :is(#login-form, #register-form) input:focus {
    border-color: var(--auth-gold-dark);
    background: var(--auth-input-hover);
    box-shadow: 0 0 0 4px rgba(243, 201, 93, 0.12);
}

:is(#login-modal, #register-modal) :is(#login-form, #register-form) input::placeholder {
    color: var(--auth-placeholder);
}

:is(#login-modal, #register-modal) :is(#login-form, #register-form) button {
    box-sizing: border-box;
    height: 42px;
    min-height: 42px;
    padding: 10px 12px;
    margin-top: 4px;
    border: 1px solid #FFD978;
    border-radius: 11px;
    background: linear-gradient(180deg, #FFE291 0%, #F1C85B 100%);
    color: #0A1422;
    font-size: 14px;
    box-shadow: 0 6px 24px rgba(216, 165, 49, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

:is(#login-modal, #register-modal) :is(#login-form, #register-form) button:hover {
    background: linear-gradient(180deg, #FFE9A8 0%, #F7D36D 100%);
    border-color: #FFE49A;
}

:is(#login-modal, #register-modal) .auth-switch--auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    padding-top: 0;
    border-top: 0;
    color: var(--auth-text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

:is(#login-modal, #register-modal) .auth-switch--auth::before,
:is(#login-modal, #register-modal) .auth-switch--auth::after {
    content: "";
    min-width: 12px;
    height: 1px;
    flex: 1 1 auto;
    background: linear-gradient(90deg, transparent, rgba(243, 201, 93, 0.55));
}

:is(#login-modal, #register-modal) .auth-switch--auth::after {
    background: linear-gradient(90deg, rgba(243, 201, 93, 0.55), transparent);
}

:is(#login-modal, #register-modal) .auth-switch__action {
    padding: 0 0 2px;
    border: 0;
    border-bottom: 1px solid currentColor;
    border-radius: 0;
    background: none;
    color: var(--auth-gold);
    font: 600 13px/1.25 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    white-space: nowrap;
    cursor: pointer;
}

:is(#login-modal, #register-modal) .auth-switch__action:hover {
    color: var(--auth-gold-light);
}

@media (max-width: 480px) {
    :is(#login-modal, #register-modal) .modal-content {
        padding: 20px 18px;
        border-radius: 20px;
    }

    :is(#login-modal, #register-modal) .modal-content h3 {
        margin: 6px 26px 18px;
        font-size: 22px;
    }

    :is(#login-modal, #register-modal) .auth-switch--auth {
        flex-wrap: wrap;
        gap: 4px 8px;
        font-size: 13px;
    }

    :is(#login-modal, #register-modal) .auth-switch--auth::before,
    :is(#login-modal, #register-modal) .auth-switch--auth::after {
        display: none;
    }

    :is(#login-modal, #register-modal) .auth-switch__action {
        font-size: 13px;
    }
}
