/* Import modern Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --background: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.07), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Status Colors */
    --status-pending-bg: #fef3c7;
    --status-pending-text: #d97706;
    --status-progress-bg: #dbeafe;
    --status-progress-text: #2563eb;
    --status-completed-bg: #d1fae5;
    --status-completed-text: #059669;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at 10% 20%, rgba(216, 241, 230, 0.46) 0.1%, rgba(233, 226, 226, 0.28) 90.1%), var(--background);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* Auth Pages Styling (Login & Registration) */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 520px;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

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

.auth-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: #f9fafb;
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.file-input-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    background: #f9fafb;
    cursor: pointer;
    transition: var(--transition);
}

.file-input-wrapper:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-input-icon {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #4f46e5 100%);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #34d399 100%);
    color: #fff;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-hover) 0%, var(--secondary) 100%);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Alert Messages */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid transparent;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left-color: #10b981;
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15);
}

.sidebar-logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo span {
    background: none;
    color: #fff;
    width: auto;
    height: auto;
    border-radius: 0;
    display: inline;
    font-size: 1rem;
    font-weight: 700;
}

.user-profile-widget {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 2rem;
    text-align: center;
}

.profile-widget-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.75rem;
    border: 3px solid var(--primary);
    background-color: #334155;
}

.profile-widget-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.profile-widget-pos {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.profile-widget-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
}

.sidebar-menu {
    list-style: none;
    margin-top: 1rem;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom scrollbar for sidebar menu */
.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.sidebar-menu a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.sidebar-menu li.active a {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-logout {
    background: rgba(239, 68, 68, 0.05);
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.85rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-logout:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

/* Main Dashboard Area */
.main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
    margin-left: 280px; /* Fixed width to offset sidebar */
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.main-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
}

.main-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Grid Layout for Forms and Lists */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 2fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        max-height: none;
    }
}

/* Card Component */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Task Cards Styling */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.task-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    transition: var(--transition);
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.task-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}

/* Badges for status */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.badge-in-progress {
    background-color: var(--status-progress-bg);
    color: var(--status-progress-text);
}

.badge-completed {
    background-color: var(--status-completed-bg);
    color: var(--status-completed-text);
}

.task-desc {
    color: var(--text-muted);
    font-size: 0.925rem;
    margin-bottom: 1.25rem;
    white-space: pre-line;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.task-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-user img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.task-due {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.task-due.overdue {
    color: #ef4444;
}

/* User Card (List of Users) */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-card-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.user-card-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.user-card-details h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.user-card-details p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Task Update Form for normal users */
.task-update-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    border-top: 1px dashed var(--border);
    padding-top: 1rem;
}

.task-update-form select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 0.875rem;
}

/* Utility classes */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.flex-1 { flex: 1; }

.logo-icon {
    font-weight: bold;
}

/* Super Admin Dashboard Special Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid #f87171;
    color: #ef4444;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    width: auto;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
}

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

.role-pill {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.role-super { background-color: #fee2e2; color: #b91c1c; }
.role-treasury { background-color: #e0e7ff; color: #4338ca; }
.role-staff { background-color: #f3f4f6; color: #4b5563; }

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001; /* above sidebar */
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    background: #4338ca;
}

/* Base Main Content Transition for smooth sidebar toggle */
.main-content {
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    /* Show Hamburger Menu */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide Sidebar by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    /* Show Sidebar when active */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Force Main Content to take full width and override inline styles */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 4rem 1rem 1rem 1rem !important; /* Top padding to avoid toggle button */
    }

    /* Make grids single column */
    .dashboard-grid,
    .d-flex {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem !important;
    }

    .stat-card {
        padding: 1.5rem;
    }

    /* Fix table scrolling */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
