/* ============================================================
   Instituto Caracol - Admin Panel Styles
   ============================================================ */

:root {
    --admin-sidebar: 260px;
    --admin-header: 60px;
    --admin-green: #2d7a2d;
    --admin-green-dark: #1a4a1a;
    --admin-bg: #f1f5f1;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body.admin-body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--admin-bg);
    color: #1f2937;
    font-size: 0.9rem;
    min-height: 100vh;
}

/* --- Admin Layout --- */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--admin-sidebar);
    background: var(--admin-green-dark);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: #fff;
    height: var(--admin-header);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.admin-content {
    padding: 2rem 1.5rem;
    flex: 1;
}

/* --- Sidebar --- */
.sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.95rem;
}

.sidebar-brand-sub {
    color: rgba(255,255,255,0.4);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-nav { padding: 1rem 0; flex: 1; }

.sidebar-section { margin-bottom: 0.5rem; }

.sidebar-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.3);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255,255,255,0.65);
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(61,158,61,0.2);
    color: #7ecf7e;
    border-left-color: #56b556;
}

.sidebar-link i { width: 18px; text-align: center; font-size: 0.875rem; }

.sidebar-link .badge-count {
    margin-left: auto;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    font-size: 0.7rem;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    background: rgba(61,158,61,0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7ecf7e;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-name {
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-user-role {
    color: rgba(255,255,255,0.35);
    font-size: 0.7rem;
}

.sidebar-user-logout {
    margin-left: auto;
    color: rgba(255,255,255,0.3);
    font-size: 1rem;
    transition: color 0.2s;
}
.sidebar-user-logout:hover { color: #ef4444; }

/* --- Admin Header --- */
.admin-header-left { display: flex; align-items: center; gap: 1rem; }

.admin-page-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
}

.admin-header-right { display: flex; align-items: center; gap: 0.75rem; }

.admin-notification-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: #f3f4f6;
    transition: all 0.2s;
    text-decoration: none;
}
.admin-notification-btn:hover { background: #e5e7eb; color: #111827; }
.admin-notification-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* --- Cards --- */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #111827;
}

.card-body { padding: 1.25rem; }

/* --- Stats Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.orange { background: #ffedd5; color: #c2410c; }
.stat-icon.purple { background: #f3e8ff; color: #7e22ce; }
.stat-icon.red { background: #fee2e2; color: #991b1b; }

.stat-info { flex: 1; }
.stat-number { font-size: 1.75rem; font-weight: 800; color: #111827; line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.78rem; color: #6b7280; font-weight: 500; }
.stat-change { font-size: 0.72rem; color: #10b981; font-weight: 600; margin-top: 0.25rem; }

/* --- Tables --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
}

.admin-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f9fafb;
    font-size: 0.875rem;
    color: #374151;
    vertical-align: middle;
}

.admin-table tr:hover td { background: #f9fafb; }
.admin-table tr:last-child td { border-bottom: none; }

/* --- Form Elements --- */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.4rem;
}

.form-label.required::after { content: ' *'; color: #ef4444; }

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #111827;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--admin-green);
    box-shadow: 0 0 0 3px rgba(45,122,45,0.1);
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.3rem;
}

.form-row { display: grid; gap: 1rem; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    cursor: pointer;
    border: 1.5px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary { background: var(--admin-green); color: #fff; border-color: var(--admin-green); }
.btn-primary:hover { background: var(--admin-green-dark); }

.btn-outline { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-outline:hover { background: #f3f4f6; }

.btn-danger { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: #10b981; color: #fff; border-color: #10b981; }
.btn-success:hover { background: #059669; }

.btn-warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-warning:hover { background: #d97706; }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; }

/* --- Status Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.625rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-green, .badge-publicado { background: #dcfce7; color: #15803d; }
.badge-gray, .badge-rascunho { background: #f3f4f6; color: #6b7280; }
.badge-red, .badge-arquivado { background: #fee2e2; color: #991b1b; }
.badge-blue, .badge-em_andamento { background: #dbeafe; color: #1d4ed8; }
.badge-purple, .badge-concluido { background: #f3e8ff; color: #7e22ce; }
.badge-yellow, .badge-planejamento { background: #fef9c3; color: #854d0e; }
.badge-orange, .badge-novo { background: #ffedd5; color: #c2410c; }
.badge-teal, .badge-lido { background: #ccfbf1; color: #0f766e; }
.badge-indigo, .badge-respondido { background: #e0e7ff; color: #3730a3; }

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.page-header-title { font-size: 1.25rem; font-weight: 800; color: #111827; }
.page-header-subtitle { font-size: 0.82rem; color: #6b7280; margin-top: 0.2rem; }

/* --- Filters Bar --- */
.filters-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 0.875rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #374151;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--admin-green); }

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.875rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #374151;
    background: #fff;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--admin-green); }

/* --- Image Preview --- */
.image-preview {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #e5e7eb;
}

.file-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s;
    background: #f9fafb;
    cursor: pointer;
}
.file-upload-zone:hover, .file-upload-zone.drag-over {
    border-color: var(--admin-green);
    background: #f0fdf0;
}
.file-upload-zone p { color: #6b7280; font-size: 0.875rem; margin-top: 0.5rem; }
.file-upload-zone i { font-size: 2rem; color: #d1d5db; }

/* --- Alert --- */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

/* --- Action Icons in Table --- */
.table-actions { display: flex; gap: 0.4rem; align-items: center; }

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.action-btn-view { background: #dbeafe; color: #1d4ed8; }
.action-btn-edit { background: #dcfce7; color: #15803d; }
.action-btn-delete { background: #fee2e2; color: #991b1b; }
.action-btn-view:hover { background: #bfdbfe; }
.action-btn-edit:hover { background: #bbf7d0; }
.action-btn-delete:hover { background: #fecaca; }

/* --- Pagination --- */
.pagination { display: flex; gap: 0.35rem; align-items: center; justify-content: center; margin-top: 1.5rem; }
.page-link {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    background: #fff;
    transition: all 0.2s;
    text-decoration: none;
}
.page-link:hover { background: #f3f4f6; }
.page-link.active { background: var(--admin-green); color: #fff; border-color: var(--admin-green); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s;
}
.modal-backdrop.active { opacity: 1; visibility: visible; }

.modal {
    background: #fff;
    border-radius: 14px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    transform: scale(0.95);
    transition: transform 0.25s;
}
.modal-backdrop.active .modal { transform: scale(1); }

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-weight: 700; font-size: 1rem; color: #111827; }
.modal-close {
    width: 30px; height: 30px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    color: #6b7280;
    background: #f3f4f6;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.modal-close:hover { background: #e5e7eb; color: #111827; }

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Responsive Admin */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
