/* ==========================================
   SISTEMA DE AUTENTICAÇÃO - CSS
   ========================================== */

/* --- MODAL OVERLAY --- */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- MODAL --- */
.auth-modal {
    background: #1a2332;
    border-radius: 20px;
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Scrollbar */
.auth-modal::-webkit-scrollbar {
    width: 6px;
}
.auth-modal::-webkit-scrollbar-track {
    background: transparent;
}
.auth-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* --- BOTÃO FECHAR --- */
.auth-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #aaa;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}
.auth-close:hover {
    background: rgba(255, 50, 50, 0.2);
    color: #ff5555;
    transform: rotate(90deg);
}

/* --- TABS --- */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 20px;
}

.auth-tab {
    flex: 1;
    padding: 16px 10px;
    background: none;
    border: none;
    color: #777;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.auth-tab.active {
    color: #e0e0e0;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 15%;
    right: 15%;
    height: 3px;
    background: linear-gradient(90deg, #ff6b35, #ff8e53);
    border-radius: 3px 3px 0 0;
}

.auth-tab:hover:not(.active) {
    color: #bbb;
}

/* --- FORMULÁRIO --- */
.auth-form {
    padding: 24px 28px 28px;
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff6b35, #ff8e53);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 24px;
    color: #fff;
}

.auth-header h3 {
    color: #e8e8e8;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
}

.auth-header p {
    color: #888;
    font-size: 14px;
    margin: 0;
}

/* --- FORM GROUPS --- */
.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-group label {
    display: block;
    color: #bbb;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.auth-form .form-group input[type="email"],
.auth-form .form-group input[type="password"],
.auth-form .form-group input[type="text"],
.auth-form .form-group select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.25s;
    outline: none;
    box-sizing: border-box;
}

.auth-form .form-group input:focus,
.auth-form .form-group select:focus {
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.auth-form .form-group input::placeholder {
    color: #555;
}

.auth-form .form-group small {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.auth-form .form-group select {
    appearance: none;
    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='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* Password Input */
.password-input {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input input {
    padding-right: 44px !important;
}

.btn-eye {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 6px 8px;
    font-size: 14px;
    transition: color 0.2s;
}
.btn-eye:hover {
    color: #aaa;
}

/* --- FORM OPTIONS --- */
.auth-form .form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    font-size: 13px;
}

.auth-form .form-options .checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #999;
}

.auth-form .form-options .checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ff6b35;
    cursor: pointer;
}

.auth-form .form-options a {
    color: #ff6b35;
    text-decoration: none;
    transition: color 0.2s;
}
.auth-form .form-options a:hover {
    color: #ff8e53;
    text-decoration: underline;
}

/* --- BOTÕES DE AUTH --- */
.btn-auth-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ff6b35, #ff8e53);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}
.btn-auth-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.35);
}
.btn-auth-primary:active {
    transform: translateY(0);
}
.btn-auth-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-auth-secondary {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #aaa;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    font-family: 'Inter', sans-serif;
}
.btn-auth-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ddd;
}

/* --- DIVIDER --- */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    gap: 12px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}
.auth-divider span {
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* --- SOCIAL BUTTONS --- */
.auth-social {
    display: flex;
    gap: 10px;
}

.btn-social {
    flex: 1;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ccc;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    font-family: 'Inter', sans-serif;
}

.btn-social.google:hover {
    background: rgba(234, 67, 53, 0.12);
    border-color: rgba(234, 67, 53, 0.4);
    color: #ea4335;
}

.btn-social.facebook:hover {
    background: rgba(66, 103, 178, 0.12);
    border-color: rgba(66, 103, 178, 0.4);
    color: #4267B2;
}

/* --- MENU DO USUÁRIO LOGADO --- */
.user-menu-container {
    position: relative;
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 12px;
    transition: background 0.2s;
}
.user-avatar:hover {
    background: rgba(255, 255, 255, 0.06);
}

.avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #ff8e53);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: #e0e0e0;
    font-size: 13px;
    font-weight: 600;
}

.user-email {
    color: #777;
    font-size: 11px;
}

.user-avatar .fa-chevron-down {
    color: #666;
    font-size: 10px;
    transition: transform 0.2s;
}
.user-avatar.active .fa-chevron-down {
    transform: rotate(180deg);
}

/* --- DROPDOWN MENU --- */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #1a2332;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: hidden;
}
.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #ff8e53);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.dropdown-name {
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 600;
}

.dropdown-email {
    color: #777;
    font-size: 12px;
}

.dropdown-menu {
    padding: 8px;
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 4px 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #bbb;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 13px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: 'Inter', sans-serif;
}
.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
}

.dropdown-item.logout {
    color: #e74c3c;
}
.dropdown-item.logout:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #ff6b6b;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

/* --- USER MENU --- */
.user-menu-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* --- RESPONSIVO --- */
@media (max-width: 768px) {
    .auth-modal {
        width: 95%;
        max-height: 95vh;
        border-radius: 16px;
    }

    .auth-form {
        padding: 20px;
    }

    .auth-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .auth-header h3 {
        font-size: 18px;
    }

    .auth-social {
        flex-direction: column;
    }

    .user-info {
        display: none;
    }

    .user-avatar .fa-chevron-down {
        display: none;
    }

    .user-dropdown {
        position: fixed; /* Mudar para fixed no mobile para melhor controle */
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
        border: none;
        border-top: 1px solid rgba(255,255,255,0.1);
        z-index: 99999;
    }

    .user-dropdown.show {
        transform: translateY(0);
    }

    .dropdown-header {
        padding: 20px;
        background: rgba(255,255,255,0.03);
    }
    
    .dropdown-menu {
        padding: 10px 20px 30px; /* Padding extra embaixo para safe area */
    }

    .dropdown-item {
        padding: 14px 16px;
        font-size: 15px;
        border-bottom: 1px solid rgba(255,255,255,0.03);
    }

    .dropdown-item:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .auth-form {
        padding: 16px;
    }
    .auth-modal {
        border-radius: 12px;
    }
}
