:root {
    --r360-color: #dc2626;
    --turma-color: #059669;
    --central-color: #7c3aed;
}
body { background: #0f172a; color: #e2e8f0; }
#login-screen { z-index: 9999 !important; }
.sidebar { background: #1e293b; width: 260px; z-index: 40; transition: transform 0.3s ease; }
.main-content { margin-left: 260px; transition: margin-left 0.3s ease; }
.card { background: #1e293b; border-radius: 12px; }
.card-header { border-bottom: 1px solid #334155; }
.btn-primary { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.btn-primary:hover { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.site-badge { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.site-r360 { background: rgba(220,38,38,0.2); color: #fca5a5; border: 1px solid #dc2626; }
.site-turma { background: rgba(5,150,105,0.2); color: #6ee7b7; border: 1px solid #059669; }
.site-central { background: rgba(124,58,237,0.2); color: #c4b5fd; border: 1px solid #7c3aed; }
.nav-item { padding: 12px 20px; border-radius: 8px; margin: 4px 12px; cursor: pointer; transition: all 0.2s; }
.nav-item:hover { background: #334155; }
.nav-item.active { background: #3b82f6; }
.stat-card { padding: 24px; border-radius: 16px; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; right: 0; width: 100px; height: 100px; border-radius: 50%; opacity: 0.1; transform: translate(30%, -30%); }
.stat-r360::before { background: #dc2626; }
.stat-turma::before { background: #059669; }
.stat-central::before { background: #7c3aed; }
.table-row:hover { background: #334155; }
.status-published { color: #4ade80; }
.status-draft { color: #fbbf24; }
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 50; align-items: center; justify-content: center; }
.modal.active { display: flex; }
.modal-content { background: #1e293b; border-radius: 16px; max-width: 800px; width: 90%; max-height: 90vh; overflow-y: auto; }
.toast { position: fixed; bottom: 20px; right: 20px; padding: 16px 24px; border-radius: 8px; z-index: 100; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.loading { display: inline-block; width: 20px; height: 20px; border: 2px solid #ffffff; border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: 100%; right: 0; background: #1e293b; border: 1px solid #334155; border-radius: 8px; display: none; min-width: 180px; z-index: 40; }
.dropdown.active .dropdown-menu { display: block; }
.editor-content { min-height: 300px; border: 1px solid #334155; border-radius: 8px; padding: 16px; }

/* Quill overrides - dark mode */
.ql-toolbar { background: #334155; border-color: #475569 !important; border-top-left-radius: 8px; border-top-right-radius: 8px; }
.ql-container { border-color: #475569 !important; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; font-size: 16px; }
.ql-editor { color: #e2e8f0; min-height: 300px; max-height: 50vh; overflow-y: auto; }
/* Quill editor images - contained size */
.ql-editor img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
    margin: 4px 0;
}
/* Quill toolbar icons visible in dark mode */
.ql-toolbar .ql-stroke { stroke: #e2e8f0 !important; }
.ql-toolbar .ql-fill { fill: #e2e8f0 !important; }
.ql-toolbar .ql-picker-label { color: #e2e8f0 !important; }
.ql-toolbar .ql-picker-options { background: #1e293b !important; border-color: #475569 !important; }
.ql-toolbar .ql-picker-item { color: #e2e8f0 !important; }
.ql-toolbar .ql-picker-item:hover { color: #3b82f6 !important; }
.ql-toolbar button:hover .ql-stroke { stroke: #3b82f6 !important; }
.ql-toolbar button:hover .ql-fill { fill: #3b82f6 !important; }
.ql-toolbar button.ql-active .ql-stroke { stroke: #3b82f6 !important; }
.ql-toolbar button.ql-active .ql-fill { fill: #3b82f6 !important; }

/* Hamburger button - hidden on desktop */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 50;
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.hamburger-btn:hover { background: #334155; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 35;
}
.sidebar-overlay.active { display: block; }

/* Page loading overlay */
.page-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Pagination buttons */
.pagination-btn {
    padding: 6px 12px;
    border-radius: 6px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.pagination-btn:hover { background: #475569; }
.pagination-btn.active { background: #3b82f6; border-color: #3b82f6; }
.pagination-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Bulk actions bar */
.bulk-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #1e40af;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    animation: slideDown 0.2s ease;
}
.bulk-bar .bulk-actions { display: flex; gap: 8px; }
.bulk-bar button { padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; border: none; }
.bulk-bar .bulk-publish { background: #16a34a; color: white; }
.bulk-bar .bulk-publish:hover { background: #15803d; }
.bulk-bar .bulk-unpublish { background: #d97706; color: white; }
.bulk-bar .bulk-unpublish:hover { background: #b45309; }
.bulk-bar .bulk-delete { background: #dc2626; color: white; }
.bulk-bar .bulk-delete:hover { background: #b91c1c; }
.bulk-bar .bulk-cancel { background: transparent; color: #93c5fd; border: 1px solid #3b82f6; }
.bulk-bar .bulk-cancel:hover { background: rgba(59,130,246,0.2); }
@keyframes slideDown { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Image lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 60; display: flex; align-items: center; justify-content: center; cursor: zoom-out; animation: fadeIn 0.2s ease; }
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.lightbox-info { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(30,41,59,0.9); padding: 8px 20px; border-radius: 8px; color: #e2e8f0; font-size: 13px; text-align: center; }
.lightbox-close { position: absolute; top: 20px; right: 20px; background: rgba(255,255,255,0.1); border: none; color: white; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.lightbox-close:hover { background: rgba(255,255,255,0.2); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Category card actions */
.cat-actions { opacity: 0; transition: opacity 0.2s; }
.card:hover .cat-actions { opacity: 1; }
.cat-action-btn { background: #334155; border: none; color: #94a3b8; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.cat-action-btn:hover { background: #475569; color: #e2e8f0; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state i { font-size: 48px; color: #475569; margin-bottom: 16px; display: block; }
.empty-state p { color: #64748b; margin-bottom: 16px; }
.empty-state button { padding: 8px 20px; border-radius: 8px; font-size: 14px; cursor: pointer; border: none; }

/* 5.6: Toast close button */
.toast { display: flex; align-items: center; gap: 12px; }
.toast-close { background: none; border: none; color: inherit; font-size: 20px; cursor: pointer; padding: 0 0 0 8px; opacity: 0.7; line-height: 1; }
.toast-close:hover { opacity: 1; }

/* 6.3: Trash status */
.status-trash { color: #94a3b8; }

/* 6.4: Drag-and-drop zone */
.drop-zone {
    position: relative;
    border: 2px dashed #475569;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}
.drop-zone.drag-over, .drag-over {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}
.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Article image section drag-over */
#article-image-section.drag-over {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

/* 7.4: Mobile card view */
.materias-card-view { display: none; }

/* 7.5: Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}
.skeleton-text { height: 14px; display: block; }
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Image overlay (gallery cards) */
.img-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 8px;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.group:hover .img-overlay { opacity: 1; }
.img-overlay .img-filename {
    font-size: 11px;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.img-overlay .img-size {
    font-size: 10px;
    color: #94a3b8;
}
.img-overlay .img-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}
.img-overlay .img-actions button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #e2e8f0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}
.img-overlay .img-actions button:hover { background: rgba(255,255,255,0.3); }
.img-overlay .img-actions button.img-delete-btn:hover { background: rgba(220,38,38,0.7); }

/* Image select checkbox */
.img-select-cb {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3b82f6;
    opacity: 0;
    transition: opacity 0.2s;
}
.group:hover .img-select-cb,
.img-select-cb:checked { opacity: 1; }

/* Gallery drag-drop state */
#imagensGrid.drag-over {
    border: 2px dashed #3b82f6;
    border-radius: 12px;
    background: rgba(59,130,246,0.05);
}

/* Bulk bar for images (reuses bulk-bar pattern) */
.img-bulk-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #1e40af;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    animation: slideDown 0.2s ease;
}
.img-bulk-bar button {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}

/* Lightbox enhanced info bar */
.lightbox-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.lightbox-info button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}
.lightbox-info button:hover { background: rgba(255,255,255,0.3); }
.lightbox-info button.lb-delete:hover { background: rgba(220,38,38,0.7); }

/* Responsive: tablets and below */
@media (max-width: 1024px) {
    .hamburger-btn { display: flex; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .bulk-bar { flex-wrap: wrap; }
}

/* 7.4: Mobile breakpoint - card view */
@media (max-width: 768px) {
    .materias-table-view { display: none; }
    .materias-card-view { display: block; }
    /* Stack filter bar vertically */
    #page-materias .card.mb-6 .p-4 { flex-direction: column; }
    #page-materias .card.mb-6 select,
    #page-materias .card.mb-6 input[type="text"] { width: 100%; }
}
