/*
* style.css - Main stylesheet for WALUKUBA EAST PRIMARY SCHOOL
* School Management System
*/

/* ==========================================================================
   Reset and Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #60a5fa;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --success-color: #22c55e;

    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --bg-app: #f8fafc;

    --border-color: #e5e7eb;
    --border-dark: #d1d5db;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --sidebar-width: 280px;
    --navbar-height: 80px;
}

html,
body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-app);
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

ul,
ol {
    padding-left: 1.25rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

/* ==========================================================================
   Main App Layout
   ========================================================================== */

.app-wrapper {
    min-height: 100vh;
    width: 100%;
    background: var(--bg-app);
}

.main-container {
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    background: var(--bg-app);
    overflow-x: hidden;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.content {
    width: 100%;
    max-width: 100%;
    padding: 24px;
    overflow-x: hidden;
}

.dashboard,
.page-content,
.container-fluid,
.container {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.navbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: var(--navbar-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 900;
    overflow: hidden;
    transition: left 0.3s ease, width 0.3s ease;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
}

.nav-left {
    gap: 0.75rem;
    min-width: 0;
}

.nav-right {
    gap: 1rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.page-title,
.user-name,
.user-role {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-actions,
.notifications,
.user-menu {
    flex-shrink: 0;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    max-width: 340px;
}

.user-info {
    min-width: 0;
}

.page-header,
.form-card,
.summary-card,
.stat-card,
.status-dashboard,
.events-section,
.settings-container,
.terms-table-container,
.year-card,
.dashboard-card,
.card {
    width: 100%;
    max-width: 100%;
}

table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}

.table-responsive,
.fees-table-container,
.terms-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   Common Utility Classes
   ========================================================================== */

.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info { color: var(--info-color); }

.bg-primary { background: var(--primary-color); color: #fff; }
.bg-success { background: var(--success-color); color: #fff; }
.bg-danger { background: var(--danger-color); color: #fff; }
.bg-warning { background: var(--warning-color); color: #fff; }
.bg-info { background: var(--info-color); color: #fff; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-100 { width: 100%; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 8px -1px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-info {
    background: #06b6d4;
    color: white;
}

.btn-info:hover {
    background: #0891b2;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.05rem;
}

.btn-icon {
    padding: 8px;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    border: none;
    cursor: pointer;
}

.btn-icon:hover {
    background: #f1f5f9;
    color: #2563eb;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInDown 0.3s ease-out;
}

.alert i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid var(--success-color);
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
    border-left: 4px solid var(--info-color);
}

/* ==========================================================================
   Cards / Panels
   ========================================================================== */

.card,
.dashboard-card,
.form-card,
.summary-card,
.status-dashboard,
.events-section,
.settings-container,
.year-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #fafafa;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group label i {
    color: var(--primary-color);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all 0.25s ease;
    background: white;
    color: var(--text-primary);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover,
.form-control:hover {
    border-color: var(--border-dark);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-light);
    font-size: 0.95rem;
}

textarea {
    resize: vertical;
    min-height: 110px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Tables
   ========================================================================== */

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.table th {
    text-align: left;
    padding: 14px 12px;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
}

.table tbody tr:hover td {
    background: #f8fafc;
}

/* ==========================================================================
   Badges / Status
   ========================================================================== */

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
}

.status-badge.active,
.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive,
.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.pending,
.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.ongoing,
.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.completed {
    background: #e2e8f0;
    color: #334155;
}

.status-badge.published {
    background: #dcfce7;
    color: #166534;
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
}

.empty-state i {
    margin-bottom: 1rem;
    color: #cbd5e1;
}

/* ==========================================================================
   Login Page Specific Styles
   ========================================================================== */

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.login-container {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-page .school-logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: var(--shadow-lg);
    display: block;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.motto {
    color: var(--text-secondary);
    font-size: 1rem;
    font-style: italic;
    position: relative;
    display: inline-block;
}

.motto::before,
.motto::after {
    content: '"';
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 600;
}

.motto::before {
    margin-right: 0.25rem;
}

.motto::after {
    margin-left: 0.25rem;
}

.login-form {
    margin-bottom: 1.5rem;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    accent-color: var(--primary-color);
}

.checkbox:hover {
    color: var(--text-primary);
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

.forgot-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.forgot-link:hover {
    color: var(--primary-dark);
}

.forgot-link:hover::after {
    width: 100%;
}

.btn-login {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
}

.btn-login:hover::before {
    width: 300px;
    height: 300px;
}

.btn-login i {
    font-size: 1.125rem;
    transition: transform 0.3s ease;
}

.btn-login:hover i {
    transform: translateX(5px);
}

.login-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    margin-bottom: 0.25rem;
}

.system-info {
    font-size: 0.75rem;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.login-info {
    display: flex;
    align-items: center;
}

.info-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideInRight 0.6s ease-out;
}

.info-card i.fa-school {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: white;
    opacity: 0.9;
}

.info-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.info-card p {
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.6;
    font-size: 1rem;
}

.quick-links {
    margin-bottom: 2rem;
}

.quick-links h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: white;
}

.quick-links ul {
    list-style: none;
    padding-left: 0;
}

.quick-links li {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

.quick-links li:hover {
    transform: translateX(5px);
    opacity: 1;
}

.quick-links li i {
    width: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.school-contact {
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.school-contact p {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.school-contact p:last-child {
    margin-bottom: 0;
}

.school-contact i {
    width: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   Animation Keyframes
   ========================================================================== */

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

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

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* ==========================================================================
   Loading States
   ========================================================================== */

.btn-login.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-login.loading i {
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.btn-login:focus-visible,
.btn:focus-visible,
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible,
.form-control:focus-visible,
.forgot-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1200px) {
    .user-btn {
        max-width: 260px;
    }
}

@media (max-width: 1024px) {
    .login-container {
        gap: 1.5rem;
    }

    .login-box,
    .info-card {
        padding: 2rem;
    }
}

@media (max-width: 992px) {
    .navbar {
        left: 0;
        width: 100%;
    }

    .main-container {
        margin-left: 0;
        width: 100%;
    }

    .content {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 14px;
    }

    .user-info {
        display: none;
    }

    .login-container {
        grid-template-columns: 1fr;
        max-width: 500px;
    }

    .login-info {
        display: none;
    }

    .login-box {
        padding: 2rem;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }

    .login-page .school-logo {
        width: 80px;
        height: 80px;
    }

    .form-options {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .table {
        min-width: 560px;
    }
}

@media (max-width: 576px) {
    .content {
        padding: 12px;
    }

    .page-header,
    .card-header,
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }

    .login-page {
        padding: 1rem;
    }

    .login-box {
        padding: 1.5rem;
    }

    .btn-login {
        padding: 0.875rem 1.25rem;
    }

    .alert {
        padding: 0.875rem 1rem;
    }
}

@media (max-width: 480px) {
    .table {
        min-width: 520px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .sidebar,
    .navbar,
    .page-actions,
    .quick-actions-section,
    .btn,
    .btn-login,
    .form-options,
    .action-buttons,
    .user-menu,
    .notifications,
    .quick-actions {
        display: none !important;
    }

    .main-container,
    .content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .login-page {
        background: white;
        padding: 0;
    }

    .login-container {
        display: block;
        max-width: 100%;
    }

    .login-info {
        display: none;
    }

    .login-box,
    .card,
    .dashboard-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .table th {
        background: #f8fafc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .badge,
    .status-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}