/* ==========================================
   SOFT UI / CLEAN MOBILE APP DESIGN SYSTEM
   Based on User Uploaded Reference
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary-color: #4D7CFE; /* Bright Blue from image */
    --primary-dark: #3a5ec5;
    --secondary-color: #2E3A59; /* Dark Blue/Grey for headings */
    --accent-color: #FFB74D; /* Warm accent (optional, for warnings etc) */
    
    --bg-color: #F2F5F9; /* Very light grey/blue background */
    --surface-color: #FFFFFF;
    
    --text-main: #2E3A59;
    --text-secondary: #8F9BB3;
    --text-light: #C5CEE0;
    
    --success-color: #00E096;
    --warning-color: #FFAA00;
    --danger-color: #FF3D71;
    --info-color: #0095FF;

    /* Spacing & Layout */
    --border-radius-sm: 12px;
    --border-radius-md: 12px;
    --border-radius-lg:12px; /* Large rounded corners as seen in image */
    
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    
    /* Shadows (Soft UI) */
    --shadow-sm: 0 2px 8px rgba(46, 58, 89, 0.04);
    --shadow-md: 0 8px 24px rgba(46, 58, 89, 0.08); /* The main card shadow */
    --shadow-lg: 0 16px 48px rgba(46, 58, 89, 0.12);
    --shadow-blue: 0 8px 16px rgba(77, 124, 254, 0.24); /* Shadow for primary buttons */
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15px;
    overflow-x: hidden;
    padding-bottom: 90px; /* Space for bottom nav */
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    line-height: 1.3;
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; font-weight: 500; }
h6 { font-size: 14px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

p { margin-bottom: 1rem; color: var(--text-secondary); }

.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-medium { font-weight: 500 !important; }

/* ==========================================
   COMPONENTS
   ========================================== */

/* Cards */
.card, .ag-card {
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: none;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

/* Hover effects removed for cleaner UI */

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 14px;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.btn-primary, .btn-islamic {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-blue);
}

.btn-primary:hover, .btn-islamic:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 12px 24px rgba(77, 124, 254, 0.32);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Form Elements */
.form-control, .form-select {
    background-color: #F7F9FC;
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-main);
    transition: var(--transition);
    width: 100%;
}

.form-control:focus, .form-select:focus {
    background-color: var(--surface-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(77, 124, 254, 0.1);
    outline: none;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bg-success { background-color: rgba(0, 224, 150, 0.15) !important; color: var(--success-color); }
.bg-danger { background-color: rgba(255, 61, 113, 0.15) !important; color: var(--danger-color); }
.bg-warning { background-color: rgba(255, 170, 0, 0.15) !important; color: var(--warning-color); }
.bg-info { background-color: rgba(0, 149, 255, 0.15) !important; color: var(--info-color); }
.bg-primary { background-color: rgba(77, 124, 254, 0.15) !important; color: var(--primary-color); }

/* ==========================================
   NAVIGATION
   ========================================== */

/* Desktop Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: var(--surface-color);
    padding: 16px 12px;
    padding-bottom: 24px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    display: none; /* Hidden on mobile */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(77, 124, 254, 0.05) 0%, rgba(93, 141, 255, 0.05) 100%);
    border-radius: 16px;
}

.logo-circle {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #5d8dff 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(77, 124, 254, 0.3);
    flex-shrink: 0;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
    font-size: 15px;
    position: relative;
    width: 100%;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(77, 124, 254, 0.08);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #5d8dff 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(77, 124, 254, 0.3);
}

.nav-link i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    opacity: 0.9;
}

.nav-link.active i {
    opacity: 1;
}

/* Logout specific style */
.nav-link.text-danger {
    color: var(--danger-color);
}

.nav-link.text-danger:hover {
    background: rgba(255, 61, 113, 0.1);
    color: var(--danger-color);
}

.nav-link.text-danger i {
    color: var(--danger-color);
}

/* Mobile Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--surface-color);
    padding: 8px 16px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 1000;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    gap: 4px;
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: 12px;
    min-width: 60px;
}

.bottom-nav-item i {
    font-size: 22px;
    transition: var(--transition);
}

.bottom-nav-item.active {
    color: var(--primary-color);
    background: rgba(77, 124, 254, 0.1);
}

.bottom-nav-item.active i {
    transform: translateY(-2px) scale(1.1);
}

.bottom-nav-item:hover:not(.active) {
    color: var(--primary-color);
    background: rgba(77, 124, 254, 0.05);
}

.bottom-nav-item.text-danger {
    color: var(--danger-color);
}

.bottom-nav-item.text-danger:hover {
    background: rgba(255, 61, 113, 0.1);
}

/* Mobile Header */
.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: transparent;
}

.user-avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #E4E9F2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
}

/* ==========================================
   RESPONSIVE LAYOUT
   ========================================== */

.main-content {
    padding: 10px;
}

@media (min-width: 992px) {
    .sidebar {
        display: block;
    }
    
    .bottom-nav, .mobile-header {
        display: none;
    }
    
    .main-content {
        margin-left: 280px;
        padding: 40px;
        width: calc(100% - 280px);
    }
    
    body {
        padding-bottom: 0;
    }
}

@media (max-width: 991px) {
    .sidebar {
        display: block;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1050;
        background: var(--surface-color);
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 24px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(46, 58, 89, 0.5);
        z-index: 1040;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

/* ==========================================
   SPECIFIC WIDGETS (From Image)
   ========================================== */

/* Calendar Widget */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    text-align: center;
}

.calendar-day-header {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.calendar-day {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
    color: var(--text-main);
    margin: 0 auto;
    cursor: pointer;
    transition: var(--transition);
}

.calendar-day.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-blue);
}

/* Hover effect removed */

/* List Items */
.list-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--surface-color);
    border-radius: var(--border-radius-md);
    margin-bottom: 12px;
    transition: var(--transition);
}

/* Hover effect removed */

.list-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(77, 124, 254, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 16px;
}

.list-content {
    flex: 1;
}

.list-title {
    font-weight: 600;
    color: var(--text-main);
    font-size: 15px;
    margin-bottom: 2px;
}

.list-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Stats Card */
.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    margin: 16px 0 4px 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    /* padding: 12px 16px; */
    border: none;
}

.table td {
    background: var(--surface-color);
    padding: 16px;
    vertical-align: middle;
    border: none;
}

.table tr td:first-child { border-top-left-radius: 16px; border-bottom-left-radius: 16px; }
.table tr td:last-child { border-top-right-radius: 16px; border-bottom-right-radius: 16px; }

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Page Title and Actions */
    .d-flex.justify-content-between {
        flex-direction: column !important;
        gap: 16px;
    }
    
    .d-flex.justify-content-between h2,
    .d-flex.justify-content-between h4 {
        font-size: 20px !important;
    }
    
    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm {
        width: auto;
        padding: 8px 12px;
    }
    
    /* Cards */
    .ag-card {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 12px;
    }
    
    .card {
        border-radius: 12px !important;
        margin-bottom: 12px;
    }
    
    .card-body {
        padding: 12px !important;
    }
    
    .card-header {
        padding: 12px !important;
    }
    
    /* Main Content Full Width */
    .main-content {
        padding: 8px !important;
    }
    
    .container-fluid {
        padding: 0 !important;
    }
    
    /* Nav Pills Scrollable */
    .nav-pills {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        padding-bottom: 8px;
    }
    
    .nav-pills .nav-link {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Search and Filters */
    .row.g-3 {
        gap: 12px !important;
    }
    
    .col-md-3, .col-md-4, .col-md-6 {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Table Responsive - Card View */
    .table-responsive {
        border: none;
        overflow: visible;
    }
    
    .table-responsive table {
        border-spacing: 0;
    }
    
    .table-responsive thead {
        display: none;
    }
    
    .table-responsive tbody {
        display: block;
    }
    
    .table-responsive tr {
        display: block;
        margin-bottom: 16px;
        background: var(--surface-color);
        border-radius: 16px;
        padding: 16px;
        box-shadow: var(--shadow-sm);
        border: 1px solid rgba(0,0,0,0.05);
    }
    
    .table-responsive td {
        display: block;
        width: 100%;
        padding: 12px 0;
        border: none;
        background: transparent;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        text-align: left !important;
    }
    
    .table-responsive td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .table-responsive td:first-child {
        padding-top: 0;
    }
    
    .table-responsive td::before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
    }
    
    .table-responsive td > * {
        display: block;
        width: 100%;
        text-align: left !important;
    }
    
    .table-responsive td a {
        word-break: break-word;
    }
    
    /* Action Buttons in Table */
    .table-responsive td .btn-group,
    .table-responsive td .d-flex {
        display: flex !important;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start !important;
    }
    
    .table-responsive td .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Badges */
    .badge {
        font-size: 11px;
        padding: 6px 12px;
        font-weight: 500;
    }
    
    /* Form Elements */
    .form-control,
    .form-select {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 16px;
        max-width: calc(100% - 32px);
    }
    
    .modal-body {
        padding: 20px;
    }
    
    /* Stats Cards */
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    /* Reduce spacing */
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    h3 { font-size: 18px; }
    h4 { font-size: 16px; }
    
    /* Main Content */
    .main-content {
        padding: 16px;
    }
    
    /* Bottom Navigation Spacing */
    body {
        padding-bottom: 80px;
    }
}

/* Extra Small Devices */
@media (max-width: 480px) {
    .mobile-header h4 {
        font-size: 16px !important;
    }
    
    .mobile-header p {
        font-size: 12px !important;
    }
    
    .btn {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .ag-card {
        padding: 12px;
    }
    
    .table-responsive tr {
        padding: 12px;
    }
    
    .table-responsive td {
        padding: 8px 0;
        font-size: 13px;
    }
    
    .table-responsive td::before {
        font-size: 11px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-header {
        padding: 12px 16px;
    }
    
    body {
        padding-bottom: 70px;
    }
    
    .bottom-nav {
        padding: 6px 12px;
    }
}

/* Tablet Specific */
@media (min-width: 769px) and (max-width: 991px) {
    .main-content {
        padding: 24px;
    }
    
    .ag-card {
        padding: 20px;
    }
    
    /* Tables remain normal on tablet */
    .table-responsive thead {
        display: table-header-group;
    }
    
    .table-responsive tr {
        display: table-row;
        margin-bottom: 0;
        padding: 0;
        box-shadow: none;
        border: none;
    }
    
    .table-responsive td {
        display: table-cell;
        padding: 16px;
        background: var(--surface-color);
        border-bottom: none;
    }
    
    .table-responsive td::before {
        content: none;
    }
}
