﻿/* GLOBAL ≋ CSS Vars */
:root {
    /* Staff palette (default) */
    --bg: #F8FAFC;
    --text: #1A2A40;
    --primary: #0047A0;
    --secondary: #465B73;
    --accent: #E8F1FF;
    --font: 'Inter', sans-serif;
    --fs-base: 16px;
    --border-radius: 4px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.12);
    --sidebar-width: 240px;
}

/* Master palette */
.app-master:root,
.app-master {
    --bg: #FFFFFF;
    --text: #121212;
    --primary: #C91C1C;
    --secondary: #2C4C9C;
    --accent: #F0F0F0;
    --font: 'Roboto Condensed', sans-serif;
    --fs-base: 17px;
    --border-radius: 2px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.1);
}

/* Student palette */
.app-student:root,
.app-student {
    --bg: #F3F7FF;
    --text: #212121;
    --primary: #5D54B8;
    --secondary: #FF6B6B;
    --accent: #E1EBFF;
    --font: 'Nunito', sans-serif;
    --fs-base: 18px;
    --border-radius: 12px;
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.08);
    --shadow-md: 0 3px 8px rgba(0,0,0,0.12);
}

/* Parent palette */
.app-parent:root,
.app-parent {
    --bg: #FAFEFF;
    --text: #1E293B;
    --primary: #1C65D7;
    --secondary: #FFA149;
    --accent: #EEF6FF;
    --font: 'Lato', sans-serif;
    --fs-base: 16px;
    --border-radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.1);
}

/* Base styles */
html, body {
    font-size: var(--fs-base);
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

/* Navbar styles */
.navbar {
    background-color: #FFFFFF;
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 1rem;
    z-index: 1030;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.navbar-brand {
    font-weight: 600;
    color: var(--primary) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .navbar-brand img {
        height: 28px;
    }

.nav-link {
    color: var(--text) !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    position: relative;
    transition: all 0.2s ease;
}

    .nav-link.active, .nav-link:hover {
        color: var(--primary) !important;
    }

        .nav-link.active::after {
            content: '';
            position: absolute;
            bottom: -0.75rem;
            left: 1rem;
            right: 1rem;
            height: 3px;
            background-color: var(--primary);
            border-radius: 3px 3px 0 0;
        }

.navbar-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* Layout container */
.layout-container {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 56px);
}

/* Sidebar */
#sidebar {
    background-color: white;
    border-right: 1px solid rgba(0,0,0,0.05);
    width: var(--sidebar-width);
    transition: all 0.3s ease;
    z-index: 1020;
    padding: 1.5rem 0;
}

    #sidebar .nav {
        flex-direction: column;
        width: 100%;
    }

    #sidebar .nav-link {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1.5rem;
        color: var(--text) !important;
        border-left: 3px solid transparent;
        margin: 0.25rem 0;
        transition: all 0.2s ease;
    }

        #sidebar .nav-link:hover,
        #sidebar .nav-link.active {
            color: var(--primary) !important;
            background-color: var(--accent);
            border-left-color: var(--primary);
        }

    #sidebar .nav-header {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: rgba(0,0,0,0.4);
        padding: 1.25rem 1.5rem 0.5rem;
        font-weight: 600;
    }

/* Content area */
main {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--bg);
    min-height: calc(100vh - 56px);
}

/* Footer */
footer {
    background-color: white;
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: rgba(0,0,0,0.6);
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* UI Components */
.card {
    border-radius: var(--border-radius);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
    background-color: white;
}

    .card:hover {
        box-shadow: var(--shadow-md);
    }

.card-header {
    background-color: rgba(0,0,0,0.02);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
}

.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

    .btn-primary:hover, .btn-primary:focus {
        background-color: var(--primary);
        filter: brightness(90%);
        border-color: var(--primary);
    }

.btn-outline-secondary {
    color: var(--secondary);
    border-color: var(--secondary);
}

    .btn-outline-secondary:hover {
        background-color: var(--secondary);
        color: #fff;
    }

/* Belt rank colors - used for various UI elements */
.belt-white {
    background-color: #FFFFFF;
}

.belt-yellow {
    background-color: #FFD700;
}

.belt-green {
    background-color: #228B22;
}

.belt-blue {
    background-color: #1E90FF;
}

.belt-red {
    background-color: #DC143C;
}

.belt-black {
    background-color: #000000;
}

/* Taegeukgi accent colors */
.taegeuk-red {
    color: #CD2E3A;
}

.taegeuk-blue {
    color: #0047A0;
}

.taegeuk-black {
    color: #000000;
}

/* Badge styles - can be used for belt ranks */
.badge-belt {
    padding: 0.35em 0.65em;
    font-weight: 700;
    border-radius: 50rem;
    display: inline-block;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* App-specific styles */
/* Staff App */
.app-staff .badge-belt {
    padding: 0.25em 0.5em;
    font-weight: 600;
}

.app-staff .card {
    border-radius: 4px;
}

/* Master App */
.app-master .badge-belt {
    padding: 0.25em 0.5em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-master .card-header {
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.app-master .btn {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

/* Student App */
.app-student .badge-belt {
    padding: 0.35em 0.75em;
    font-weight: 600;
    border-radius: 50rem;
    font-size: 0.8em;
}

.app-student .card {
    border-radius: 12px;
}

.app-student .btn {
    border-radius: 12px;
    font-weight: 600;
}

.app-student #sidebar .nav-link {
    border-radius: 0 8px 8px 0;
}

/* Parent App */
.app-parent .badge-belt {
    padding: 0.3em 0.6em;
    font-weight: 600;
}

.app-parent .btn {
    border-radius: 8px;
}

.app-parent .card {
    border-radius: 8px;
}

/* Responsiveness */
@media (max-width: 991.98px) {
    #sidebar {
        width: 64px;
        padding: 1rem 0;
    }

        #sidebar .nav-link {
            padding: 0.75rem;
            display: flex;
            flex-direction: column;
            text-align: center;
            gap: 0.25rem;
        }

            #sidebar .nav-link span {
                font-size: 0.7rem;
            }

        #sidebar .nav-header {
            display: none;
        }
}

@media (max-width: 767.98px) {
    #sidebar {
        position: fixed;
        left: -260px;
        width: var(--sidebar-width);
        top: 56px;
        height: 100%;
        transition: all 0.3s ease;
        padding: 1rem 0;
        background-color: white;
    }

        #sidebar.show {
            left: 0;
        }

        #sidebar .nav-link {
            padding: 0.75rem 1.5rem;
            flex-direction: row;
            text-align: left;
        }

            #sidebar .nav-link span {
                font-size: inherit;
            }

        #sidebar .nav-header {
            display: block;
        }
}

/* Enhanced Media Library Styles */

/* Media Library Modal Enhancements */
.media-library-context-tinymce .modal-dialog {
    max-width: 95%;
}

.media-library-context-tinymce .modal-body {
    max-height: 80vh;
    overflow-y: auto;
}

/* Upload Area Styling */
.drag-over {
    border: 2px dashed #007bff !important;
    background-color: rgba(0, 123, 255, 0.1) !important;
}

.file-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    margin: 2px 0;
}

.file-name {
    font-weight: 500;
}

.file-size {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Media Search Styling */
.media-search {
    position: relative;
}

    .media-search .search-icon {
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        color: #6c757d;
        z-index: 5;
    }

    .media-search input {
        padding-left: 35px;
    }

/* Media Grid Enhancements */
#mediaGrid {
    min-height: 300px;
}

.media-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    width: 100%;
}

.media-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

    .media-empty .empty-icon {
        font-size: 4rem;
        margin-bottom: 20px;
        opacity: 0.5;
    }

/* Media Item Cards */
.media-item {
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

    .media-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-color: #007bff;
    }

    .media-item.selected {
        border-color: #28a745;
        background-color: rgba(40, 167, 69, 0.05);
    }

.card-img-wrapper {
    position: relative;
    height: 120px;
    overflow: hidden;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.media-item:hover .media-thumbnail {
    transform: scale(1.05);
}

.file-icon {
    color: #6c757d;
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
}

/* Media Item Actions */
.media-item .btn-group {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.media-item:hover .btn-group {
    opacity: 1;
}

.media-item .btn-delete-media {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.media-item:hover .btn-delete-media {
    opacity: 1;
}

/* Bulk Actions */
.bulk-actions-container {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.media-select {
    transform: scale(1.2);
}

/* Pagination */
.media-pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    width: 100%;
}

    .media-pagination .pagination {
        margin: 0;
    }

/* Context-specific styling */
.media-library-context-html .btn-insert-img,
.media-library-context-tinymce .btn-insert-img {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.media-library-context-css .btn-insert-bg {
    background-color: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

/* Upload Progress */
#uploadProgress {
    margin-top: 10px;
    height: 6px;
}

    #uploadProgress .progress-bar {
        transition: width 0.3s ease;
    }

/* Alert Animations */
.alert {
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* TinyMCE Integration Styles */
.tox-tinymce {
    border-radius: 6px;
}

.tox .tox-toolbar__group {
    border-radius: 4px;
}

/* Bootstrap Component Preview in TinyMCE */
.mce-content-body .container,
.mce-content-body .container-fluid {
    border: 1px dashed #dee2e6 !important;
    padding: 10px !important;
    margin: 5px 0 !important;
    position: relative;
}

    .mce-content-body .container::before,
    .mce-content-body .container-fluid::before {
        content: 'Container';
        position: absolute;
        top: -12px;
        left: 10px;
        background: #fff;
        padding: 2px 6px;
        font-size: 10px;
        color: #6c757d;
        border: 1px solid #dee2e6;
        border-radius: 3px;
    }

    .mce-content-body .container-fluid::before {
        content: 'Container Fluid';
    }

.mce-content-body .row {
    border: 1px dashed #28a745 !important;
    padding: 5px !important;
    margin: 2px 0 !important;
    background: rgba(40, 167, 69, 0.05) !important;
    position: relative;
}

    .mce-content-body .row::before {
        content: 'Row';
        position: absolute;
        top: -12px;
        left: 10px;
        background: #fff;
        padding: 2px 6px;
        font-size: 10px;
        color: #28a745;
        border: 1px solid #28a745;
        border-radius: 3px;
    }

.mce-content-body [class*="col"] {
    border: 1px dashed #007bff !important;
    padding: 10px !important;
    margin: 2px 0 !important;
    background: rgba(0, 123, 255, 0.05) !important;
    position: relative;
    min-height: 40px;
}

    .mce-content-body [class*="col"]::before {
        content: attr(class);
        position: absolute;
        top: -12px;
        left: 10px;
        background: #fff;
        padding: 2px 6px;
        font-size: 10px;
        color: #007bff;
        border: 1px solid #007bff;
        border-radius: 3px;
    }

/* Responsive Design */
@media (max-width: 768px) {
    .media-library-context-tinymce .modal-dialog {
        max-width: 98%;
        margin: 10px;
    }

    .bulk-actions-container .d-flex {
        flex-direction: column;
        gap: 10px;
    }

    .media-item .btn-group {
        opacity: 1;
    }

    .media-item .btn-delete-media {
        opacity: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .media-empty {
        color: #adb5bd;
    }

    .bulk-actions-container {
        background-color: #343a40;
        border-color: #495057;
    }

    .file-preview {
        background-color: #495057;
        color: #f8f9fa;
    }
}

/* Add these styles to your admin.css or create a new CSS file */

/* User dropdown in navbar */
.navbar .dropdown-toggle {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
}

    .navbar .dropdown-toggle:hover {
        background-color: rgba(0, 0, 0, 0.05);
    }

    .navbar .dropdown-toggle::after {
        margin-left: 0.5rem;
    }

/* User info sidebar for mobile */
.user-info-sidebar {
    background-color: rgba(0, 0, 0, 0.03);
    margin-bottom: 1rem;
}

/* Role badges */
.badge.bg-secondary {
    font-size: 0.75rem;
    font-weight: normal;
}

/* Dropdown menu styling */
.dropdown-menu {
    min-width: 250px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-header {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.dropdown-item i {
    width: 1.25rem;
}

/* Role-specific color coding in navbar */
.app-admin .navbar {
    border-bottom: 3px solid #dc3545;
}

.app-master .navbar {
    border-bottom: 3px solid #28a745;
}

.app-student .navbar {
    border-bottom: 3px solid #17a2b8;
}

.app-parent .navbar {
    border-bottom: 3px solid #ffc107;
}

.app-staff .navbar {
    border-bottom: 3px solid #6c757d;
}

/* Logout button styling in sidebar */
.nav-item form {
    margin: 0;
}

    .nav-item form .btn-link {
        width: 100%;
        text-align: left;
        padding: 0.5rem 1rem;
        border: none;
        background: none;
        color: inherit;
        text-decoration: none;
    }

        .nav-item form .btn-link:hover {
            background-color: rgba(0, 0, 0, 0.05);
        }

/* User role display in navbar */
.navbar .small.text-muted {
    line-height: 1;
    margin-top: 2px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .navbar .dropdown-toggle {
        padding: 0.375rem 0.75rem;
    }

        .navbar .dropdown-toggle .fw-semibold {
            font-size: 0.875rem;
        }

        .navbar .dropdown-toggle .small {
            font-size: 0.75rem;
        }
}