/* Modern custom stylesheet for School Meeting and Feedback Management System */

:root {
    --primary: #8a1538;
    --primary-light: #be123c;
    --primary-bg: #fff1f2;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #ca8a04;
    --warning-bg: #fef9c3;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --border: #e5e7eb;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.2s ease-in-out;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
}

/* Header & Navigation */
/* Sidebar Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: #ffffff;
    color: var(--text-main);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
    border-right: 1px solid var(--border);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-logo {
    height: 70px;
    width: auto;
    margin-bottom: 0.75rem;
    object-fit: contain;
    background: transparent;
}

.sidebar-school-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
    margin: 0;
    line-height: 1.2;
}

.sidebar-school-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0.15rem 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
}

.sidebar-nav .nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.sidebar-nav .nav-item a:hover {
    color: var(--primary);
    background-color: var(--primary-bg);
}

.sidebar-nav .nav-item.active a {
    color: white;
    background-color: var(--primary);
}

.sidebar-nav .nav-icon {
    font-size: 1.1rem;
}

.main-content {
    flex: 1;
    padding: 2rem 2.5rem;
    background-color: var(--primary-bg);
    min-width: 0;
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    margin-left: 260px !important;
}

/* Mobile Header (Hidden by default on Desktop) */
.mobile-header {
    display: none;
    background-color: var(--primary);
    padding: 0.75rem 1.25rem;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 101;
    box-shadow: var(--shadow);
}

.mobile-header .nav-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive Rules for Mobile/Tablet Devices */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-260px);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.15);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem;
    }
}

/* Page Layout */
main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Typography & Titles */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.75rem;
    color: var(--primary);
    font-weight: 700;
}

/* Cards & Layout Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card-header {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-light);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-secondary {
    background-color: white;
    border-color: var(--border);
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: var(--bg-main);
}

.btn-danger {
    background-color: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}
.btn-danger:hover {
    background-color: var(--danger);
    color: white;
}

.btn-success {
    background-color: var(--success);
    color: white;
}
.btn-success:hover {
    background-color: #059669;
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-upcoming {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.badge-ongoing {
    background-color: var(--primary-bg);
    color: var(--primary-light);
}

.badge-completed {
    background-color: var(--border);
    color: var(--text-muted);
}

.badge-positive {
    background-color: var(--success-bg);
    color: var(--success);
}

.badge-negative {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.badge-improvement {
    background-color: var(--warning-bg);
    color: var(--warning);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group.required label::after {
    content: " *";
    color: var(--danger);
}

label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-control-options {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Checkbox & Radios */
.checkbox-group, .radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.checkbox-label, .radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-label input, .radio-label input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-light);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    text-align: left;
}

th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f9fafb;
}

/* Login Page specifically */
.login-body {
    background-color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.login-card {
    max-width: 400px;
    width: 100%;
    background-color: white;
    padding: 2.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.login-title {
    text-align: center;
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* Flash Messages */
.flashes {
    list-style: none;
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.flash-warning {
    background-color: var(--warning-bg);
    color: var(--warning);
    border: 1px solid #fde68a;
}

.flash-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
}

/* Home / Dashboard Stats */
.stat-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* Simple CSS Charting */
.chart-container {
    margin-top: 1rem;
}

.chart-row {
    margin-bottom: 1rem;
}

.chart-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.chart-bar-outer {
    height: 12px;
    background-color: var(--bg-main);
    border-radius: 9999px;
    overflow: hidden;
}

.chart-bar-inner {
    height: 100%;
    border-radius: 9999px;
}

.bar-positive { background-color: var(--success); }
.bar-negative { background-color: var(--danger); }
.bar-improvement { background-color: var(--warning); }
.bar-generic { background-color: var(--primary-light); }

/* Pie Chart Styles */
.pie-chart {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin: 1.5rem auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    background: #e5e7eb;
    position: relative;
}

.pie-chart-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pie-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* QR Codes Listing */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.qr-image-container {
    background-color: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
    width: 172px;
    height: 172px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-image-container img {
    max-width: 100%;
    max-height: 100%;
}

.qr-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    width: 100%;
}

.qr-actions .btn {
    flex: 1;
}

/* Field Manager Layout */
.fields-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.field-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    transition: var(--transition);
}

.field-item.inactive {
    background-color: #f9fafb;
    border-style: dashed;
    opacity: 0.7;
}

.field-item.inactive .field-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.field-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding-right: 0.5rem;
}

.field-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-grow: 1;
}

.field-details {
    display: flex;
    flex-direction: column;
}

.field-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.field-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
}

.field-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-backdrop.show {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 100%;
    padding: 1.5rem;
    margin: 1.5rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Public Form Layout */
.public-form-container {
    max-width: 600px;
    margin: 2rem auto;
    background-color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid var(--border);
}

.public-form-header {
    border-bottom: 2px solid var(--primary-bg);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.public-form-title {
    font-size: 1.5rem;
    color: var(--primary);
    font-weight: 700;
}

.public-form-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.other-specify-group {
    margin-left: 1.5rem;
    border-left: 3px solid var(--primary-bg);
    padding-left: 0.75rem;
    margin-top: -0.75rem;
    margin-bottom: 1.25rem;
    display: none;
}

.other-specify-group.show {
    display: block;
}

/* Feedback View Filters */
.filters-bar {
    background-color: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Empty & Info States */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    background-color: white;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* Dragging visual indicators */
.field-item.dragging {
    opacity: 0.5;
    background-color: var(--primary-bg);
    border-color: var(--primary-light);
}

/* Toast/Alert container */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #333;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { background-color: var(--success); }
.toast-danger { background-color: var(--danger); }
.toast-warning { background-color: var(--warning); }

/* Responsive styles */
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        background-color: var(--primary);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    .nav-menu.show {
        max-height: 300px;
        padding: 1rem 0;
    }
    
    .nav-item {
        width: 100%;
        text-align: center;
    }
    
    .nav-item a {
        display: block;
        width: 100%;
        padding: 0.75rem;
        border-radius: 0;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header .btn {
        width: 100%;
    }
}
