/* ===== Teaching Materials Distribution Platform - Custom Styles ===== */

/* --- Global --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background-color: #f5f7fa;
}

.page-shell {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Wide banner/file-space pages share one 1200px content edge on desktop. */
.space-page-shell {
    padding-left: 0;
    padding-right: 0;
}

@media (max-width: 1200px) {
    .space-page-shell {
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* --- Upload Zone --- */
.upload-zone {
    transition: all 0.3s ease;
    border-color: #dee2e6 !important;
    background: #fafbfc;
    cursor: pointer;
}
.upload-zone:hover,
.upload-zone.border-success {
    border-color: #198754 !important;
    background: #f0fdf4;
}

/* --- Border Dashed --- */
.border-dashed {
    border-style: dashed !important;
}

/* --- Cards --- */
.card {
    border: none;
    border-radius: 12px;
}
.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* --- Drag Handle --- */
.drag-handle {
    cursor: grab;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.drag-handle:hover {
    opacity: 1;
}
tr.sortable-ghost {
    background-color: #e8f5e9 !important;
    opacity: 0.6;
}
tr.sortable-chosen {
    background-color: #f1f8e9 !important;
}

/* --- File List (Student) --- */
.file-card {
    transition: background-color 0.15s ease;
}
.file-card:hover {
    background-color: #f0fdf4 !important;
}

/* --- Notice Card --- */
.notice-card {
    border-radius: 10px;
}

/* --- Login Cards --- */
.bg-light .card {
    border-radius: 16px;
}

/* --- Credential Inputs --- */
.credential-input-field {
    position: relative;
}
.credential-input-field .form-control {
    padding-left: 2.75rem;
}
.credential-password-field .form-control {
    padding-right: 3rem;
}
.credential-password-field .form-control::-ms-reveal,
.credential-password-field .form-control::-ms-clear {
    display: none;
}
.credential-password-field .form-control.is-invalid {
    padding-right: 4.25rem;
    background-position: right 2.65rem center;
}
.credential-field-icon {
    position: absolute;
    top: 50%;
    left: .9rem;
    z-index: 5;
    color: #8a929a;
    font-size: 1.05rem;
    line-height: 1;
    pointer-events: none;
    transform: translateY(-50%);
    transition: color .15s ease;
}
.credential-input-field:focus-within .credential-field-icon {
    color: var(--bs-success);
}
.credential-input-field:has(.form-control.is-invalid) .credential-field-icon {
    color: var(--bs-danger);
}
.credential-password-toggle {
    position: absolute;
    top: 50%;
    right: .45rem;
    z-index: 5;
    display: inline-flex;
    width: 2.15rem;
    height: 2.15rem;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8a929a;
    transform: translateY(-50%);
    transition: color .15s ease, background-color .15s ease;
}
.credential-password-toggle:hover {
    background: #f0f2f4;
    color: #343a40;
}
.credential-password-toggle:focus-visible {
    outline: 2px solid rgba(25, 135, 84, .35);
    outline-offset: 1px;
}
.credential-password-toggle .bi {
    font-size: 1.05rem;
    line-height: 1;
}
.credential-input-field:has(.form-control-sm) .form-control {
    padding-left: 2.35rem;
}
.credential-password-field:has(.form-control-sm) .form-control {
    padding-right: 2.55rem;
}
.credential-input-field:has(.form-control-sm) .credential-field-icon {
    left: .75rem;
    font-size: .95rem;
}
.credential-input-field:has(.form-control-sm) .credential-password-toggle {
    right: .25rem;
    width: 1.85rem;
    height: 1.85rem;
}
.credential-input-field:has(.form-control.is-invalid) + .invalid-feedback,
.was-validated .credential-input-field:has(.form-control:invalid) + .invalid-feedback,
*:has(> .credential-input-field .form-control.is-invalid) > .invalid-feedback,
.was-validated *:has(> .credential-input-field .form-control:invalid) > .invalid-feedback {
    display: block;
}

/* --- Stat Cards (Admin) --- */
.card.bg-primary, .card.bg-success, .card.bg-info {
    border-radius: 12px;
}

/* --- Badge Colors --- */
.text-purple { color: #9c27b0; }
.bg-purple { background-color: #9c27b0; }

/* --- Table --- */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
}
.table td {
    vertical-align: middle;
}

/* --- Responsive Helpers --- */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    .btn-group-sm .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    .table {
        font-size: 0.85rem;
    }
    .card-header h5 {
        font-size: 1rem;
    }
    /* Stack action buttons on mobile */
    td .btn-group {
        flex-wrap: wrap;
        gap: 2px;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 0.95rem;
    }
    .download-btn {
        min-width: 60px;
        font-size: 0.8rem;
    }
}

/* --- Pagination --- */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
}

/* --- Progress Bars --- */
.progress {
    border-radius: 4px;
}

/* --- Flash Alert Animation --- */
.alert {
    border-radius: 10px;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Scrollbar (WebKit) --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

/* Keep the same mobile gutter for banner and file-list shells. */
@media (max-width: 768px) {
    .space-page-shell {
        padding-left: 10px;
        padding-right: 10px;
    }
}
