/**
 * Professor Padel - Admin Panel Styles
 * Reutiliza identidade visual do Dark Theme da landing
 */

:root {
    --admin-bg: #21230f;
    --admin-surface: #2d3016;
    --admin-border: rgba(255, 255, 255, 0.1);
    --admin-text: #f1f5f9;
    --admin-muted: #94a3b8;
    --admin-primary: #e9ff42;
    --admin-primary-text: #21230f;
    --admin-sidebar-w: 260px;
    --font-display: 'Lexend', sans-serif;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-display);
    color: var(--admin-text);
    background: var(--admin-bg);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Login Page */
.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-bg);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    padding: 40px 32px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 1.4rem;
    margin-top: 12px;
}

.login-header p {
    color: var(--admin-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--admin-muted);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    color: var(--admin-text);
    font-family: var(--font-display);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.form-input:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 2px rgba(233, 255, 66, 0.1);
}

select.form-input {
    cursor: pointer;
    appearance: auto;
}

select.form-input option {
    background: var(--admin-bg);
    color: var(--admin-text);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-display);
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--admin-primary);
    color: var(--admin-primary-text);
    padding: 10px 20px;
    font-size: 0.9rem;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-outline:hover {
    border-color: rgba(233, 255, 66, 0.3);
    color: var(--admin-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.btn-danger:hover {
    background: #ef4444;
    color: #fff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.btn-full {
    width: 100%;
}

/* Admin Layout */
.admin-page {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--admin-sidebar-w);
    background: var(--admin-surface);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--admin-border);
}

.sidebar-header h2 {
    font-size: 1rem;
}

.sidebar-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--admin-primary);
    color: var(--admin-primary-text);
    border-radius: 100px;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--admin-border);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--admin-muted);
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--admin-text);
}

.sidebar-link.active {
    background: rgba(233, 255, 66, 0.08);
    color: var(--admin-primary);
}

.sidebar-link .material-symbols-outlined {
    font-size: 1.2rem;
}

.sidebar-link--danger:hover {
    color: #ef4444;
}

.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-w);
    min-height: 100vh;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(33, 35, 15, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--admin-border);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--admin-text);
    cursor: pointer;
}

.admin-page-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--admin-muted);
}

.admin-content {
    padding: 24px;
}

/* Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 20px;
}

.stat-card__icon {
    font-size: 2rem;
    color: var(--admin-primary);
}

.stat-card h3 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--admin-primary);
}

.stat-card p {
    font-size: 0.8rem;
    color: var(--admin-muted);
}

/* Admin Section */
.admin-section {
    margin-bottom: 32px;
}

.admin-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-section__header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Table — Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid var(--admin-border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--admin-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.admin-table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--admin-border);
}

.admin-table td.date-cell,
.admin-table td:has(time) {
    white-space: nowrap;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

code {
    font-family: monospace;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn {
    vertical-align: middle;
}

.admin-table td {
    vertical-align: middle;
}

.admin-section__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

/* Admin phone dropdown (leads modal) */
.admin-phone-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
    min-width: 260px;
}

.admin-phone-dropdown.open {
    display: block;
}

.admin-form-error {
    font-size: 0.8rem;
    color: #ef4444;
    min-height: 0;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.admin-form-error:not(:empty) {
    min-height: 1.2em;
}

.admin-phone-dropdown .phone-option {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--admin-text);
}

.admin-phone-dropdown .phone-option:hover,
.admin-phone-dropdown .phone-option.selected {
    background: rgba(255, 255, 255, 0.06);
}

.admin-phone-dropdown .phone-option-code {
    color: var(--admin-muted);
    margin-left: 12px;
}

.admin-phone-dropdown .phone-search {
    margin: 8px;
    width: calc(100% - 16px);
    font-size: 0.8rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.badge-draft {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.badge-info {
    background: var(--admin-primary);
    color: var(--admin-primary-text);
    font-weight: 700;
}

.lead-msg {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-muted {
    color: var(--admin-muted);
}

/* Post Form */
.post-form {
    max-width: 900px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group--wide {
    grid-column: 1/-1;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Image Upload */
.image-upload-area {
    border: 2px dashed var(--admin-border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.image-upload-area:hover {
    border-color: var(--admin-primary);
    background: rgba(233, 255, 66, 0.03);
}

.image-upload-area .material-symbols-outlined {
    font-size: 2rem;
    color: var(--admin-muted);
    margin-bottom: 8px;
}

.image-upload-area p {
    font-size: 0.85rem;
    color: var(--admin-muted);
}

.image-preview {
    max-width: 300px;
    border-radius: 8px;
    margin-top: 12px;
    display: none;
}

.image-preview.visible {
    display: block;
}

.image-preview img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
}

/* Rich Text Editor */
.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--admin-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.rich-editor-toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--admin-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.rich-editor-toolbar button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--admin-text);
}

.rich-editor-toolbar .separator {
    width: 1px;
    background: var(--admin-border);
    margin: 4px 4px;
}

.rich-editor-content {
    min-height: 300px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--admin-border);
    border-radius: 0 0 8px 8px;
    color: var(--admin-text);
    font-family: var(--font-display);
    font-size: 0.95rem;
    line-height: 1.7;
    outline: none;
}

.rich-editor-content:focus {
    border-color: var(--admin-primary);
}

.rich-editor-content h1,
.rich-editor-content h2,
.rich-editor-content h3 {
    margin: 0.5em 0;
}

.rich-editor-content p {
    margin: 0.5em 0;
}

.rich-editor-content ul,
.rich-editor-content ol {
    margin: 0.5em 0 0.5em 1.5em;
}

.rich-editor-content a {
    color: var(--admin-primary);
}

/* Custom Modal (replaces alert/confirm) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    animation: modalFadeIn 0.2s ease forwards;
}

@keyframes modalFadeIn {
    to {
        opacity: 1;
    }
}

.modal-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    transform: scale(0.95);
    animation: modalScaleIn 0.2s ease forwards;
}

@keyframes modalScaleIn {
    to {
        transform: scale(1);
    }
}

.modal-card__icon {
    font-size: 2.5rem;
    color: #ef4444;
    margin-bottom: 12px;
}

.modal-card__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-card__message {
    font-size: 0.9rem;
    color: var(--admin-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions .btn {
    min-width: 100px;
}

/* Mobile */
@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden;
    }

    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .admin-main {
        margin-left: 0;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .sidebar-toggle {
        display: block;
    }

    .admin-topbar {
        gap: 8px;
        padding: 12px 16px;
    }

    .admin-page-title {
        font-size: 0.9rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 150px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-content {
        padding: 16px;
        overflow-x: hidden;
    }

    .admin-section__header {
        gap: 8px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card h3 {
        font-size: 1.4rem;
    }

    .modal-card {
        padding: 24px;
    }
}

/* ============================================
   PAGINATION (Admin)
   ============================================ */
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    /* Mais espaçamento */
    margin-bottom: 24px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-muted);
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s;
    text-decoration: none;
}

.pagination-link:hover:not(.disabled) {
    border-color: rgba(233, 255, 66, 0.4);
    color: var(--admin-primary);
    background: rgba(233, 255, 66, 0.05);
}

.pagination-link.active {
    background: var(--admin-primary);
    border-color: var(--admin-primary);
    color: var(--admin-primary-text);
}

.pagination-link.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.05);
}