/* static/css/styles.css */

/* ===== Base Styles ===== */
:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --success-color: #4cc9f0;
    --info-color: #4895ef;
    --warning-color: #f72585;
    --danger-color: #7209b7;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 280px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fb;
    color: #333;
    line-height: 1.6;
}

/* ===== Navigation Styles ===== */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

/* Shajara logo — a bit larger than the first version (was max-height 52px / max-width 220px) */
.navbar-brand-logo {
    display: block;
    height: auto;
    max-height: 64px;
    width: auto;
    max-width: min(260px, 58vw);
    object-fit: contain;
}

@media (max-width: 576px) {
    .navbar-brand-logo {
        max-height: 48px;
        max-width: min(200px, 68vw);
    }
}

/* Goals panel (narrow sidebar on student notes) */
.goal-panel-sidebar .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
}
.goal-panel-sidebar .nav-tabs .nav-link {
    font-size: 0.7rem;
    padding: 0.35rem 0.45rem;
    white-space: nowrap;
}
.goal-panel-sidebar .card-header h5 {
    font-size: 0.95rem;
}

/* ===== Card Styles ===== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* ===== List Group Styles ===== */
.list-group-item {
    border: none;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

.list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ===== Table Styles ===== */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.05);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* ===== Button Styles ===== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.2);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* ===== Badge Styles ===== */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
    border-radius: 6px;
}

.badge-pill {
    border-radius: 50rem;
}

/* ===== Form Styles ===== */
.form-control {
    border-radius: 8px;
    border: 1px solid #ced4da;
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #495057;
}

.input-group-text {
    background-color: #f8f9fa;
    border-color: #ced4da;
    border-radius: 8px 0 0 8px;
}

/* ===== Alert Styles ===== */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
}

.alert-dismissible .btn-close {
    padding: 1rem;
}

/* ===== Progress Bar Styles ===== */
.progress {
    border-radius: 10px;
    height: 10px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 10px;
    background-color: var(--primary-color);
}

/* ===== Sidebar Styles ===== */
.sidebar {
    background-color: #fff;
    border-right: 1px solid #dee2e6;
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
    overflow-y: auto;
}

.sidebar .list-group {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* ===== Audio Recorder Styles ===== */
.audio-recorder-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 2rem;
    color: white;
}

.recording-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.recording-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #dc3545;
    animation: pulse 1.5s infinite;
    margin-right: 0.5rem;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== Signature Pad Styles ===== */
.signature-pad-container {
    background-color: white;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    cursor: crosshair;
}

.signature-pad-container canvas {
    border-radius: 8px;
}

/* ===== Note Content Styles ===== */
.note-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.note-content h1,
.note-content h2,
.note-content h3,
.note-content h4,
.note-content h5,
.note-content h6 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.note-content p {
    margin-bottom: 1rem;
}

.note-content ul,
.note-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

/* ===== Attachment Styles ===== */
.attachment-card {
    border-left: 4px solid var(--primary-color);
    background-color: #f8f9fa;
}

.attachment-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

/* ===== Dashboard Stats ===== */
.stats-card {
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
    margin-bottom: 1.5rem;
}

.stats-card h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card h6 {
    opacity: 0.9;
    font-weight: 500;
}

.stats-icon {
    font-size: 3rem;
    opacity: 0.8;
}

/* ===== Animation Classes ===== */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Utility Classes ===== */
.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.shadow-lg {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}

.rounded-lg {
    border-radius: 12px !important;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Responsive Styles ===== */
@media (max-width: 768px) {
    .sidebar {
        position: static;
        min-height: auto;
        margin-bottom: 1.5rem;
    }

    .stats-card h2 {
        font-size: 2rem;
    }

    .stats-icon {
        font-size: 2.5rem;
    }

    .recording-controls {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }

    .btn {
        padding: 0.375rem 0.75rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Signature Status ===== */
.signature-status {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.signature-status.verified {
    background-color: rgba(40, 167, 69, 0.1);
    border-left: 4px solid #28a745;
}

.signature-status.pending {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
}

/* ===== Note Preview Styles ===== */
.note-preview {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.note-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, white);
}

/* ===== File Upload Styles ===== */
.file-upload-area {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.1);
}

.file-list {
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    background-color: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    border: 1px solid #dee2e6;
}

.file-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
    color: var(--primary-color);
}

/* Student Notes Page Specific Styles */
.note-item {
    transition: all 0.3s ease;
}

.note-item:hover {
    background-color: rgba(67, 97, 238, 0.05);
    transform: translateX(5px);
}

.note-preview {
    max-height: 4.5em;
    overflow: hidden;
    position: relative;
    line-height: 1.5;
}

.note-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5em;
    background: linear-gradient(to bottom, transparent, white);
}

.homework-preview {
    background-color: #f8f9fa;
    border-left: 3px solid #4cc9f0;
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    border-radius: 0 4px 4px 0;
}

/* Grid View Cards */
.grid-view-card {
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-view-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Signature View */
.signature-container {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
}

/* Progress bars */
.progress {
    overflow: visible;
}

.progress-bar {
    position: relative;
    overflow: visible;
}

.progress-bar::after {
    content: attr(style);
    position: absolute;
    right: -25px;
    top: -25px;
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none;
}

.progress:hover .progress-bar::after {
    display: block;
}