/* ===========================
   RESET / BASE
   =========================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-1: #050514;
    --bg-2: #0b0b1a;
    --bg-3: #14142b;
    --accent: #7c8cff;
    --accent-2: #ff6ec7;
    --accent-grad: linear-gradient(135deg, #7c8cff 0%, #ff6ec7 100%);
    --text: #f5f6ff;
    --text-muted: #a9adc9;
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.12);
    --danger: #f87171;
    --success: #4ade80;
    --radius: 16px;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --transition: 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

html, body { min-height: 100%; }

body.admin-body {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(ellipse at top, var(--bg-3) 0%, var(--bg-2) 45%, var(--bg-1) 100%) fixed;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 24px 16px 48px;
    overflow-x: hidden;
}

.admin-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ===========================
   BOTÕES BASE
   =========================== */
.btn {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text);
    background: var(--card-bg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    min-height: 42px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { flex-shrink: 0; }

.btn-primary {
    background: var(--accent-grad);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(124, 140, 255, 0.35);
}

.btn-ghost:hover {
    border-color: var(--accent);
    background: rgba(124, 140, 255, 0.1);
}

.btn-danger-ghost {
    border-color: rgba(248, 113, 113, 0.35);
    color: var(--danger);
}

.btn-danger-ghost:hover {
    border-color: var(--danger);
    background: rgba(248, 113, 113, 0.1);
}

/* ===========================
   LOGIN
   =========================== */
.login-container {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 32px 32px;
    background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--accent-grad);
    color: #fff;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 10px;
    color: #fecaca;
    font-size: 0.85rem;
}

.login-error svg { flex-shrink: 0; color: var(--danger); }

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group label svg { color: var(--accent); }

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color var(--transition), background var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(169, 173, 201, 0.6);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(124, 140, 255, 0.06);
}

.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-right: 44px;
}

.toggle-senha {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: color var(--transition), background var(--transition);
}

.toggle-senha:hover { color: var(--accent); background: rgba(124, 140, 255, 0.1); }
.toggle-senha.is-visible { color: var(--accent-2); }

.btn-login {
    background: var(--accent-grad);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
    margin-top: 8px;
}

.btn-login:hover { filter: brightness(1.08); }

.btn-back-home {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px;
}

.btn-back-home:hover { color: var(--accent); }

.login-blocked {
    text-align: center;
    padding: 20px 0;
}

.login-blocked svg {
    color: var(--danger);
    margin-bottom: 12px;
}

.login-blocked p {
    color: var(--danger);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ===========================
   HEADER ADMIN
   =========================== */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 24px;
    background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.header-content h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 4px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-content h1 svg {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}

.header-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.header-content p strong { color: var(--text); }

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===========================
   STATS
   =========================== */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    transition: transform var(--transition), border-color var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 140, 255, 0.4);
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(124, 140, 255, 0.15);
    color: var(--accent);
    flex-shrink: 0;
}

.stat-info { display: flex; flex-direction: column; }

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* ===========================
   TOOLBAR
   =========================== */
.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 220px;
    max-width: 420px;
}

.search-box svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition), background var(--transition);
}

.search-box input::placeholder { color: rgba(169, 173, 201, 0.6); }

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(124, 140, 255, 0.06);
}

/* ===========================
   PAINEL DIAS FALTANDO
   =========================== */
.dias-faltando-panel {
    padding: 20px 24px;
    background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
}

.panel-header { margin-bottom: 14px; }

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.panel-header h3 svg { color: var(--accent); }

.hint {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.dias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.dia-chip {
    padding: 8px 6px;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    user-select: none;
}

.dia-chip:hover {
    border-color: var(--accent);
    background: rgba(124, 140, 255, 0.12);
    color: var(--text);
    transform: translateY(-1px);
}

.dia-chip.is-hoje {
    border-color: var(--accent-2);
    color: var(--accent-2);
    font-weight: 700;
}

.dias-grid > p {
    grid-column: 1 / -1;
    color: var(--success);
    font-weight: 600;
    padding: 12px 0;
    text-align: center;
}

/* ===========================
   TABELA
   =========================== */
.table-container {
    background: linear-gradient(160deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    overflow-x: auto;
}

.frases-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.frases-table thead {
    background: rgba(0, 0, 0, 0.25);
}

.frases-table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
}

.frases-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--card-border);
    vertical-align: middle;
}

.frases-table tbody tr {
    transition: background var(--transition);
}

.frases-table tbody tr:hover {
    background: rgba(124, 140, 255, 0.06);
}

.frases-table td:first-child {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.frases-table td:nth-child(2) {
    max-width: 340px;
}

.frase-category {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(124, 140, 255, 0.15);
    color: var(--accent);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 6px;
}

.btn-edit, .btn-delete {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-edit:hover { border-color: var(--accent); color: var(--accent); background: rgba(124, 140, 255, 0.1); }
.btn-delete:hover { border-color: var(--danger); color: var(--danger); background: rgba(248, 113, 113, 0.1); }

.btn-edit svg, .btn-delete svg { display: block; }

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.modal {
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    overflow-y: auto;
    background: linear-gradient(160deg, #1a1a35, #12122a);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: slideUp 0.25s ease;
}

.modal-confirm { max-width: 460px; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
}

.modal-header svg { color: var(--accent); flex-shrink: 0; }

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-body { padding: 20px 24px; }

.modal-body form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.data-error, .data-success {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    margin-top: 8px;
}

.data-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.data-error svg { flex-shrink: 0; color: var(--danger); margin-top: 2px; }

.data-success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.35);
    color: #bbf7d0;
}

.data-success svg { flex-shrink: 0; color: var(--success); margin-top: 2px; }

.data-sugestao {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: rgba(124, 140, 255, 0.12);
    border: 1px solid rgba(124, 140, 255, 0.3);
    border-radius: 8px;
    color: #c7ceff;
    font-size: 0.85rem;
}

.data-sugestao svg { flex-shrink: 0; color: var(--accent); }

.data-sugestao strong { color: var(--text); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    flex-wrap: wrap;
}

.btn-cancel {
    background: transparent;
    color: var(--text-muted);
}

.btn-cancel:hover { border-color: var(--text-muted); color: var(--text); }

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.btn-success:hover:not(:disabled) { filter: brightness(1.08); }

.btn-success:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-confirm-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.btn-confirm-delete:hover { filter: brightness(1.08); }

.modal-confirm .modal-body {
    text-align: center;
}

.modal-confirm .modal-body > svg {
    color: var(--danger);
    margin-bottom: 12px;
}

.modal-confirm .modal-body > p {
    font-size: 0.92rem;
    margin-bottom: 16px;
}

.frase-preview {
    padding: 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    font-style: italic;
}

.frase-preview-text {
    font-size: 0.92rem;
    margin-bottom: 6px;
    color: var(--text);
}

.frase-preview-author {
    font-size: 0.82rem;
    color: var(--accent);
    font-weight: 600;
}

/* ===========================
   NOTIFICAÇÃO
   =========================== */
.notification {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 20px);
    padding: 12px 20px;
    background: rgba(20, 20, 43, 0.96);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    max-width: calc(100vw - 32px);
    text-align: center;
}

.notification.show { opacity: 1; transform: translate(-50%, 0); }
.notification.success { border-color: var(--success); }
.notification.error   { border-color: var(--danger); }
.notification.info    { border-color: var(--accent); }

/* ===========================
   RESPONSIVIDADE
   =========================== */
@media (max-width: 720px) {
    .admin-header { flex-direction: column; align-items: flex-start; }

    .form-row { grid-template-columns: 1fr; }

    .frases-table th:nth-child(4),
    .frases-table td:nth-child(4) {
        display: none;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box { max-width: none; }
}

@media (max-width: 520px) {
    body.admin-body { padding: 16px 12px 32px; }
    .login-card { padding: 32px 20px 24px; }
    .admin-stats { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 14px; }
    .stat-icon { width: 38px; height: 38px; }
    .stat-value { font-size: 1.2rem; }
}

/* ===========================
   ACESSIBILIDADE
   =========================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}