@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8f9fa;
}

/* Drag & Drop */
.drag-over-valid {
    background-color: #d1fae5 !important;
    outline: 2px dashed #10b981 !important;
    outline-offset: -2px;
}

.drag-over-invalid {
    background-color: #fee2e2 !important;
    outline: 2px dashed #ef4444 !important;
    outline-offset: -2px;
    cursor: no-drop !important;
}

.is-dragging {
    opacity: 0.4;
}

/* Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Table Sticky */
#jadwalTable th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f8fafc;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#jadwalTable .time-col {
    position: sticky;
    left: 0;
    z-index: 10;
    background: #fdfdfd;
    font-weight: 600;
    border-right: 2px solid #e2e8f0;
    min-width: 90px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.02);
}

#jadwalTable tr {
    border-bottom: 2px solid #f1f5f9;
}

#jadwalTable tr:last-child {
    border-bottom: none;
}

/* Dragging */
.grouped-lesson,
.schedule-item {
    touch-action: none;
    cursor: grab;
    transition: all 0.2s ease;
}

.grouped-lesson:active,
.schedule-item:active {
    cursor: grabbing;
}

.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    border: 2px dashed #3b82f6 !important;
    z-index: 50;
}

.drag-over {
    background-color: #eff6ff !important;
    outline: 2px dashed #60a5fa;
    outline-offset: -2px;
}

.grouped-lesson:hover {
    filter: brightness(95%);
}

/* Card Actions */
.card-actions {
    position: absolute;
    top: -8px;
    right: -4px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.15s ease;
    z-index: 30;
}

.grouped-lesson:hover .card-actions,
.schedule-item:hover .card-actions {
    opacity: 1;
    transform: scale(1);
}

.card-action-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.1s ease;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-action-btn.edit {
    color: #3b82f6;
    border-color: #bfdbfe;
}

.card-action-btn.edit:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}

.card-action-btn.delete {
    color: #ef4444;
    border-color: #fecaca;
}

.card-action-btn.delete:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* Time Input */
input[type="time"]::-webkit-calendar-picker-indicator {
    display: none;
}

input[type="time"] {
    text-align: center;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 200;
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

.toast.info {
    background: #3b82f6;
}

.toast.warning {
    background: #f59e0b;
}

/* Swap UI */
body.swap-mode-active .schedule-item,
body.swap-mode-active .grouped-lesson {
    cursor: crosshair !important;
}

.swap-selected {
    border: 3px solid #f59e0b !important;
    transform: scale(1.05);
    z-index: 50;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.swap-selected::after {
    content: 'SUMBER';
    position: absolute;
    top: -10px;
    right: -5px;
    background: #f59e0b;
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.swap-suggest-valid {
    border: 2px dashed #10b981 !important;
    opacity: 1 !important;
    background-color: #ecfdf5 !important;
}

.swap-suggest-invalid {
    opacity: 0.3 !important;
    filter: grayscale(100%);
    cursor: not-allowed !important;
    pointer-events: none;
}

/* Z-Index */
#swapUIContainer {
    z-index: 9999;
}

#curriculumModal {
    z-index: 10000;
}

#curriculumTargetModal {
    z-index: 10001 !important;
}

/* Modal Drag */
.modal-drag-header {
    cursor: move;
    user-select: none;
}

#curriculumTargetModal .resizable-modal {
    resize: both;
    overflow: auto;
    min-width: 400px;
    min-height: 300px;
    max-width: 95vw;
    max-height: 90vh;
}

/* Print */
@media print {

    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0 !important;
        padding: 0 !important;
        background: white;
    }

    body>*:not(#printContent) {
        display: none !important;
    }

    #printContent {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white;
        z-index: 999999;
    }

    @page {
        size: A4 landscape;
        margin: 5mm;
    }

    #printContent table {
        width: 100%;
        border-collapse: collapse;
        border: 2px solid #000;
        font-family: 'Times New Roman', serif;
        font-size: 10pt;
    }

    #printContent th,
    #printContent td {
        border: 1px solid #000;
        padding: 4px;
        text-align: center;
    }

    #printContent th {
        background-color: #e5e5e5 !important;
        font-weight: bold;
    }

    .page-break-after {
        page-break-after: always;
    }
}

/* Print Preview */
#printPreviewContent {
    font-family: 'Times New Roman', serif;
}

#printPreviewContent table {
    border-collapse: collapse;
    width: 100%;
}

#printPreviewContent th,
#printPreviewContent td {
    border: 1px solid #333;
    padding: 4px 6px;
    text-align: center;
    vertical-align: top;
    font-size: 10px;
}

#printPreviewContent th {
    background: #e5e5e5;
    font-weight: bold;
}

#printPreviewContent .cell-content {
    font-size: 9px;
    line-height: 1.3;
}

#printPreviewContent .cell-mapel {
    font-weight: 600;
    color: #1a1a1a;
}

#printPreviewContent .cell-guru {
    font-size: 8px;
    color: #444;
}

/* Backup */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.backup-needed {
    background-color: #fef2f2 !important;
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
    animation: pulse-red 2s infinite;
}

.backup-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ef4444;
    color: white;
    font-size: 9px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 10;
}

/* ============================================================================ 
   GUEST MODE RESTRICTIONS
   ============================================================================ */

/* Hide admin-only elements */
body.is-guest .admin-only,
body.is-guest #btnOpenTargetEditor,
body.is-guest .card-actions,
body.is-guest [data-list] .group-hover\:opacity-100 {
    display: none !important;
}

/* Disable drag and drop for guests */
body.is-guest .schedule-drop-target {
    pointer-events: none !important;
}

body.is-guest .schedule-item,
body.is-guest .grouped-lesson {
    cursor: default !important;
    pointer-events: auto !important; /* Allow click/hover but not drag */
    -webkit-user-drag: none;
}

/* Ensure info bar sections look balanced without buttons */
body.is-guest .admin-only + .admin-only {
    display: none !important;
}