/* ==============================
   VARIÁVEIS
============================== */
:root {
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --bg-sidebar: #111827;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --input-bg: #ffffff;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
}

.dark {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --border-color: #334155;
    --input-bg: #334155;
}

/* ==============================
   BASE
============================== */
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
}

/* ==============================
   LAYOUT APP
============================== */
.app-layout {
    display: flex;
    height: 100vh;
}

.app-sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.app-sidebar h2 {
    margin-bottom: 20px;
}

.app-sidebar button {
    margin: 6px 0;
    padding: 12px;
    border: none;
    background: #1f2937;
    color: white;
    cursor: pointer;
    border-radius: 6px;
    text-align: left;
    transition: 0.2s;
    font-size: 14px;
}

.app-sidebar button:hover {
    background: #374151;
}

.app-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: var(--bg-main);
}

/* ==============================
   PÁGINAS (CABEÇALHO)
============================== */
.page-header {
    margin-bottom: 1.75rem;
}

.page-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.35rem, 2.5vw, 1.6rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-main);
}

.page-lead {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-muted);
    max-width: 42rem;
}

/* ==============================
   HEADER MOBILE
============================== */
.main-header {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.menu-toggle {
    font-size: 22px;
    cursor: pointer;
}

/* ==============================
   OVERLAY
============================== */
.sidebar-overlay,
.chat-overlay {
    display: none;
}

@media (max-width: 768px) {
    .main-header {
        display: flex;
    }

    .app-layout {
        flex-direction: column;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 50%;
        height: 100%;
        z-index: 9999;
        transition: 0.3s;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .app-sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9998;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .app-content {
        padding: 15px;
    }
}

/* =========================================
   LOADER GLOBAL
========================================= */

.app-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .4s ease, visibility .4s ease;
}

body.dark .app-loader {
    background: rgba(17, 24, 39, 0.96);
}

.app-loader.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: fadeUp .5s ease;
}

.loader-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    animation: pulse 1.5s infinite;
}

.loader-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #6366f1;
    animation: spin .8s linear infinite;
}

.loader-box span {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: .5px;
}

body.dark .loader-box span {
    color: #d1d5db;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: .8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================
   UTILITÁRIOS & CARDS
============================== */
.center {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

.highlight {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.top5 {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-weight: bold;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.expired {
    color: red;
    font-weight: bold;
}

/* ==============================
   LOGIN
============================== */
.login-card {
    width: 320px;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.login-card input {
    width: 93%;
    margin: 8px 0;
    padding: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.login-card button {
    width: 100%;
    margin: 8px 0;
    padding: 10px;
}

/* ==============================
   DASHBOARD GRID
============================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat p {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: var(--text-main);
    line-height: 1.2;
}

/* ==============================
   SESSÕES (WHATSAPP CARDS)
============================== */
.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.session-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    min-height: 420px;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.qr-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-main);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    min-height: 240px;
}

.qr-container img {
    display: block;
    width: 190px !important;
    height: 190px !important;
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px;
}

/* ==============================
   BOTÕES & STATUS
============================== */
.primary-btn {
    padding: 12px 20px;
    background: var(--accent);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    margin-bottom: 20px;
    touch-action: manipulation;
}

.primary-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.primary-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.danger-btn {
    padding: 12px 20px;
    background: #ef4444;
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    margin-bottom: 20px;
    touch-action: manipulation;
}

.danger-btn:hover {
    background: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
}

.danger-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 800;
}

.status.green {
    background: #065f46;
    color: #d1fae5;
}

.status.orange {
    background: #92400e;
    color: #fef3c7;
}

.status.red {
    background: #7f1d1d;
    color: #fee2e2;
}

/* ==============================
   CHAT / MESSAGES
============================== */
.chat-layout {
    display: flex;
    height: calc(100vh - 180px);
    overflow: hidden;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: relative;
}

.chat-conversations {
    width: 240px;
    min-width: 240px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    transition: 0.3s;
}

.chat-messages {
    /* flex: 1; */
    display: flex;    
    flex-direction: column;
    background: var(--bg-main);
    width: 100%;
    min-width: 0;
    height: 95%;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-toggle {
    display: none;
    font-size: 20px;
    cursor: pointer;
    touch-action: manipulation;
}

#chatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
    height: 100%;
}

.chat-input {
    border-top: 1px solid var(--border-color);
    padding: 10px;
    display: flex;
    gap: 8px;
    background: var(--bg-card);
    flex-wrap: nowrap;
    position: relative;
}

#chatText {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
}

.chat-search {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.chat-search input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    box-sizing: border-box;
}

#conversationsList {
    flex: 1;
    overflow-y: auto;
}

.conv-info,
.conv-time {
    font-size: 12px;
}

.chat-conversation {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-main);
    transition: 0.2s;
}

.chat-conversation:hover {
    background: var(--input-bg);
}

.chat-conversation.active {
    background: var(--accent) !important;
    color: white !important;
}

#msgSession {
    color: var(--text-main);
}

/* ==============================
   MENSAGENS BOLHAS
============================== */
.chat-message {
    display: flex;
    width: 100%;
}

.chat-sent {
    justify-content: flex-end;
}

.chat-received {
    justify-content: flex-start;
}

.chat-bubble {
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    max-width: 70%;
    word-break: break-word;
    position: relative;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.chat-sent .chat-bubble {
    background: #059669;
    color: white;
    border: none;
}

.chat-received .chat-bubble {
    background: var(--bg-card);
    color: var(--text-main);
}

@media (max-width: 768px) {
    .chat-layout {
        flex-direction: column;
        height: calc(100vh - 140px);
    }

    .chat-conversations {
        position: fixed;
        top: 0;
        left: -100%;
        width: 60%;
        height: 100%;
        z-index: 9999;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .chat-conversations.open {
        left: 0;
    }

    .chat-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9998;
    }

    .chat-overlay.show {
        display: block;
    }

    .mobile-toggle {
        display: block;
    }

    .chat-input {
        padding: 8px;
        gap: 5px;
    }

    #chatText {
        padding: 8px;
        font-size: 14px;
    }

    .chat-bubble {
        max-width: 85%;
        font-size: 13px;
    }

    /* No mobile, os botões de ação da mensagem ficam sempre visíveis (opacidade reduzida) */
    .msg-reply-btn,
    .msg-options-btn {
        opacity: 0.6;
        display: inline-block;
    }

    .chat-bubble:active .msg-reply-btn,
    .chat-bubble:active .msg-options-btn {
        opacity: 1;
    }
}

.has-unread {
    background: rgba(37, 99, 235, 0.08);
    border-left: 3px solid #2563eb;
}

/* ==============================
   EMOJI
============================== */
.emoji-box {
    position: absolute;
    bottom: 80px;
    left: 14px;
    width: 270px;
    height: 300px;
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow-y: auto;
    display: none;
    padding: 10px;
    z-index: 999;
}

.emoji-box span {
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    display: inline-block;
}

.emoji-box span:hover {
    background: var(--input-bg);
    border-radius: 5px;
}

/* ==============================
   CONTACTS MODAL - CORRIGIDO
============================== */
.contacts-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    height: auto;
    max-height: 80vh;
    display: none;
    flex-direction: column;
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    z-index: 10000;
    overflow: hidden;
}

.contacts-header {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.contacts-header input {
    width: 100%;
    padding: 10px;
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
}

.contact-item {
    padding: 14px;
    cursor: pointer;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    touch-action: manipulation;
    font-size: 16px;
}

.contact-item:hover,
.contact-item:active {
    background: var(--input-bg);
}

/* ==============================
   PLAYER DE ÁUDIO
============================== */
.audio-player-container {
    display: flex;
    align-items: center;
    margin: 5px 0;
    padding: 10px;
    max-width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    gap: 12px;
}

.audio-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.audio-avatar span {
    font-size: 24px;
    line-height: 1;
}

.audio-mic-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--bg-card);
    z-index: 5;
}

.whatsapp-audio {
    height: 40px;
    width: 100%;
    filter: invert(100%) hue-rotate(180deg) brightness(1.5) grayscale(1);
    opacity: 0.8;
}

:not(.dark) .whatsapp-audio {
    filter: sepia(20%) saturate(70%) grayscale(1) contrast(90%);
}

#recordAudioBtn {
    transition: all 0.3s ease;
    touch-action: manipulation;
}

#recordAudioBtn.recording-active {
    background: #ff4b4b !important;
    border-color: #ff4b4b !important;
    transform: scale(1.2);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 75, 75, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0);
    }
}

/* ==============================
   BOTÕES DE AÇÃO (RESPONDER E OPÇÕES) - CORRIGIDO
============================== */
.msg-reply-btn,
.msg-options-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: opacity 0.2s;
    color: inherit;
    touch-action: manipulation;
    position: absolute;
    top: 5px;
}

.msg-reply-btn {
    right: 5px;
}

.msg-options-btn {
    right: 35px;
}

/* Desktop: aparecem no hover */
@media (min-width: 769px) {

    .msg-reply-btn,
    .msg-options-btn {
        opacity: 0;
    }

    .chat-bubble:hover .msg-reply-btn,
    .chat-bubble:hover .msg-options-btn {
        opacity: 1;
    }
}

/* Mobile: já definido acima dentro do @media (max-width: 768px) */

.msg-options-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    padding: 5px 0;
    display: none;
    min-width: 160px;
}

.msg-options-menu div {
    padding: 12px 16px;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text-main);
    font-size: 14px;
    touch-action: manipulation;
}

.msg-options-menu div:hover,
.msg-options-menu div:active {
    background: var(--input-bg);
}

/* ==============================
   CITAÇÃO
============================== */
.quoted-message {
    border-left: 3px solid #25D366;
    padding-left: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    opacity: 0.9;
    word-break: break-word;
    color: inherit;
}

.quoted-sender {
    font-weight: bold;
    color: #075e54;
    margin-bottom: 2px;
}

.quoted-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.chat-sent .quoted-message {
    border-left-color: rgba(255, 255, 255, 0.7);
}

.chat-sent .quoted-sender {
    color: rgba(255, 255, 255, 0.9);
}

/* ==============================
   LINK PREVIEWS
============================== */
.link-preview-card,
.link-preview-youtube,
.link-preview-video,
.link-preview-instagram {
    margin: 8px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: box-shadow 0.2s;
    max-width: 320px;
    width: fit-content;
}

.link-preview-card:hover,
.link-preview-youtube:hover,
.link-preview-video:hover,
.link-preview-instagram:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.link-preview-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-preview-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px 0 0 10px;
    background: #eee;
    flex-shrink: 0;
}

.link-preview-card .preview-text {
    padding: 8px 10px 8px 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.link-preview-card strong {
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
    color: var(--text-main);
    font-size: 13px;
}

.link-preview-card small {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-preview-card.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
    gap: 8px;
    min-width: 200px;
}

.link-preview-card.loading::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.link-preview-youtube iframe {
    width: 100%;
    height: 200px;
    border: none;
    border-radius: 10px;
}

.link-preview-instagram iframe {
    width: 100% !important;
    min-width: 100% !important;
    border: none;
    border-radius: 10px;
}

.link-preview-video video {
    width: 100%;
    max-height: 250px;
    background: #000;
    border-radius: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 480px) {

    .link-preview-card,
    .link-preview-youtube,
    .link-preview-video,
    .link-preview-instagram {
        max-width: 100%;
    }

    .link-preview-card a {
        flex-direction: column;
        align-items: flex-start;
    }

    .link-preview-card img {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-radius: 10px 10px 0 0;
    }

    .link-preview-youtube iframe,
    .link-preview-instagram iframe {
        height: 200px;
    }
}

/* ==============================
   WEBHOOK
============================== */
.webhook-form-card {
    margin-bottom: 25px;
    padding: 25px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.webhook-form-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-top: 15px;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 13px;
}

.input-field {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    box-sizing: border-box;
    font-size: 14px;
}

.webhook-card-url {
    word-break: break-all;
    font-family: monospace;
    font-size: 11px;
    background: var(--bg-main);
    padding: 8px;
    border-radius: 4px;
    display: block;
    margin-top: 5px;
    border: 1px solid var(--border-color);
}

/* ==============================
   ADMIN PAGE
============================== */
.admin-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-page .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-page .search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-main);
}

.admin-page .table-wrapper {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.admin-page .admin-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.admin-page .admin-table th {
    text-align: left;
    padding: 12px;
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 13px;
}

.admin-page .admin-table td {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.admin-page .admin-table tr:hover {
    background: var(--input-bg);
}

.admin-page .actions {
    display: flex;
    gap: 8px;
}

.admin-page .btn-edit {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-page .btn-edit:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.admin-page .btn-edit:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-page .btn-delete {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-page .btn-delete:hover {
    background: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.admin-page .btn-delete:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-page .modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    padding: 10px;
    box-sizing: border-box;
}

.admin-page .modal-content {
    background: var(--bg-card);
    padding: 20px;
    width: min(420px, 90%);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.admin-page .hidden {
    display: none;
}

.admin-page .modal-content input,
.admin-page .modal-content select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    box-sizing: border-box;
}

.admin-page .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* ==============================
   TELA ALTERAR SENHA
============================== */
.change-password-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 20px;
    min-height: 100vh;
    background: var(--bg-main);
}

.change-password-page h1 {
    margin-bottom: 30px;
    color: var(--text-main);
    font-size: 28px;
}

.change-password-card {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-sizing: border-box;
}

.change-password-card input {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 14px;
    box-sizing: border-box;
    transition: border 0.2s, box-shadow 0.2s;
}

.change-password-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
    outline: none;
}

.change-password-card div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
}

.change-password-card button {
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    border: none;
    transition: 0.2s;
    font-size: 14px;
    touch-action: manipulation;
}

#changePasswordMessage {
    margin-top: 10px;
    font-size: 0.9rem;
}

/* ==============================
   TOASTS
============================== */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 22rem;
}

.toast {
    pointer-events: auto;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.dark .toast--error {
    border-color: #7f1d1d;
    background: #450a0a;
    color: #fecaca;
}

.toast--success {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.dark .toast--success {
    border-color: #065f46;
    background: #064e3b;
    color: #d1fae5;
}

.toast--info {
    border-color: var(--border-color);
}