/*
 * Beautiful Islamic-Themed Styles for Iqra Wartqi Student Dashboard
 * Primary Colour: #234e52 (Dark Teal)
 * Secondary Colour: #7f1102 (Deep Red)
 * Third Colour: #d4a373 (Golden Brown)
 * Fourth Colour: #a3be8c (Sage Green)
 * Primary Font (English/Latin): 'Philosopher', sans-serif
 * Arabic Font: 'Amiri', serif
 */

/* --- CSS Variables for Consistent Theming --- */
:root {
    --color-primary: #234e52;
    --color-primary-light: #2d6a6f;
    --color-primary-dark: #1a3c3f;
    --color-secondary: #7f1102;
    --color-secondary-light: #a83a29;
    --color-tertiary: #d4a373;
    --color-tertiary-light: #e7c8a9;
    --color-quaternary: #a3be8c;
    --color-quaternary-light: #c9d9bb;
    --color-text: #2d3748;
    --color-text-light: #718096;
    --color-bg: #f8f9fa;
    --color-white: #ffffff;
    --color-light: #f5f7f9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --sidebar-width: 300px;
}

/* --- Basic Reset & Body --- */
.iw-dashboard-body {
    background-color: var(--color-bg);
    font-family: 'Philosopher', sans-serif;
    color: var(--color-text);
    overflow-x: hidden;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

* {
    box-sizing: border-box;
}

/* --- Islamic Pattern Background --- */
.iw-islamic-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(163, 190, 140, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(212, 163, 115, 0.05) 0%, transparent 20%),
        linear-gradient(45deg, transparent 49%, rgba(35, 78, 82, 0.03) 50%, transparent 51%),
        linear-gradient(-45deg, transparent 49%, rgba(35, 78, 82, 0.03) 50%, transparent 51%);
    background-size: 300px 300px, 300px 300px, 40px 40px, 40px 40px;
    background-position: 0 0, 0 0, 0 0, 0 0;
    pointer-events: none;
    z-index: -1;
}

/* --- Dashboard Wrapper --- */
.iw-dashboard-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* --- Sidebar Styling --- */
.iw-dashboard-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: linear-gradient(to bottom, var(--color-primary-dark), var(--color-primary));
    color: var(--color-white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--color-primary-light);
    overflow: hidden;
}

/* --- CHANGE 1: Styles for new centered sidebar header --- */
.iw-sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.iw-sidebar-avatar-container img {
    border-radius: 50%;
    border: 4px solid var(--color-tertiary);
    box-shadow: 0 0 15px rgba(212, 163, 115, 0.5);
    width: 96px;
    height: 96px;
}

.iw-user-welcome {
    margin-top: 15px;
}

.iw-welcome-message {
    display: flex;
    flex-direction: column;
    font-size: 16px;
    color: var(--color-white);
    margin: 0;
    padding: 0;
}

.iw-arabic-greeting {
    font-family: 'Amiri', serif;
    font-size: 18px;
    margin-bottom: 5px;
    color: var(--color-quaternary-light);
}

.iw-user-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--color-white);
}

/* Navigation Styling */
.iw-sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

.iw-sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.iw-nav-item a {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--color-white);
    text-decoration: none;
    font-size: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.iw-nav-item a:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: var(--transition);
}

.iw-nav-item a:hover:before {
    left: 100%;
}

.iw-nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    transition: var(--transition);
}

.iw-nav-icon i {
    font-size: 18px;
}

.iw-nav-content {
    flex: 1;
}

.iw-nav-item a span {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.iw-nav-detail {
    font-size: 13px;
    opacity: 0.8;
}

.iw-nav-item a:hover {
    background-color: rgba(212, 163, 115, 0.15);
    padding-left: 25px;
}

.iw-nav-item a:hover .iw-nav-icon {
    background: rgba(212, 163, 115, 0.3);
    transform: scale(1.1);
}

.iw-nav-item.active a {
    background-color: var(--color-secondary);
}

.iw-nav-item.active a .iw-nav-icon {
    background: rgba(255, 255, 255, 0.2);
}

.iw-nav-logout {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.iw-nav-logout a {
    background: rgba(0, 0, 0, 0.1);
}

.iw-nav-logout a:hover {
    background-color: rgba(127, 17, 2, 0.3) !important;
}

.iw-sidebar-footer {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.iw-islamic-decoration {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.1);
}

.iw-decoration-text {
    font-family: 'Amiri', serif;
    font-size: 18px;
    color: var(--color-tertiary-light);
}

/* --- Main Content Styling --- */
.iw-dashboard-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 30px;
    transition: margin-left 0.3s ease-in-out;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.iw-content-header {
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 15px;
}

.iw-content-header:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--color-primary), var(--color-tertiary));
    border-radius: 2px;
}

.iw-content-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

.iw-content-header h1:after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, var(--color-primary), transparent);
}

.iw-content-header p {
    font-size: 16px;
    color: var(--color-text-light);
    max-width: 600px;
}

/* --- Widgets Grid --- */
.iw-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.iw-widget-card {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-md);
    border-left: 5px solid var(--color-primary);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.iw-widget-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.iw-widget-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.iw-widget-card:nth-child(2) { 
    border-color: var(--color-quaternary);
}

.iw-widget-card:nth-child(3) { 
    border-color: var(--color-tertiary);
}

.iw-widget-card:nth-child(4) { 
    border-color: var(--color-secondary);
}

.iw-widget-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.iw-widget-icon {
    font-size: 22px;
    color: var(--color-white);
    background-color: var(--color-primary);
    border-radius: 50%;
    width: 55px;
    height: 55px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    box-shadow: var(--shadow-sm);
}

.iw-widget-card:nth-child(2) .iw-widget-icon { 
    background-color: var(--color-quaternary);
}

.iw-widget-card:nth-child(3) .iw-widget-icon { 
    background-color: var(--color-tertiary);
}

.iw-widget-card:nth-child(4) .iw-widget-icon { 
    background-color: var(--color-secondary);
}

.iw-widget-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.iw-widget-body {
    flex-grow: 1;
}

.iw-widget-stat {
    font-size: 36px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
    line-height: 1.2;
}

.iw-widget-desc {
    font-size: 14px;
    color: var(--color-text-light);
    margin-top: 10px;
}

.iw-widget-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.iw-widget-action {
    display: inline-flex;
    align-items: center;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}

.iw-widget-action i {
    margin-left: 8px;
    transition: var(--transition);
}

.iw-widget-action:hover {
    color: var(--color-primary-dark);
}

.iw-widget-action:hover i {
    transform: translateX(4px);
}

/* --- Mobile Header --- */
.iw-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--color-white);
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow-sm);
}

.iw-mobile-nav-toggle {
    background: var(--color-white);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    color: var(--color-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    z-index: 10;
}

.iw-mobile-nav-toggle:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.iw-hamburger {
    position: relative;
    width: 20px;
    height: 2px;
    background: var(--color-primary);
    transition: var(--transition);
}

.iw-hamburger:before, .iw-hamburger:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: var(--color-primary);
    transition: var(--transition);
}

.iw-hamburger:before {
    top: -6px;
}

.iw-hamburger:after {
    top: 6px;
}

.iw-sidebar-visible .iw-hamburger {
    background: transparent;
}

.iw-sidebar-visible .iw-hamburger:before {
    transform: rotate(45deg);
    top: 0;
}

.iw-sidebar-visible .iw-hamburger:after {
    transform: rotate(-45deg);
    top: 0;
}

.iw-mobile-logo-img {
    max-width: 140px;
    height: auto;
}

.iw-mobile-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.iw-mobile-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--color-tertiary-light);
}

.iw-mobile-user-name {
    font-weight: 600;
    color: var(--color-primary);
    display: none;
}

/* --- Sidebar Overlay --- */
.iw-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(3px);
}

/* --- Content Cards --- */
.iw-content-card {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.iw-content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.iw-content-card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

/* --- Responsive Design --- */

/* Tablets and below */
@media (max-width: 992px) {
    .iw-mobile-header {
        display: flex;
    }
    
    .iw-dashboard-sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .iw-sidebar-visible .iw-dashboard-sidebar {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0,0,0,0.3);
    }
    
    .iw-sidebar-visible .iw-sidebar-overlay {
        display: block;
    }

    .iw-dashboard-content {
        width: 100%;
        margin-left: 0;
        padding: 20px 15px;
    }
    
    .iw-content-header h1 {
        font-size: 28px;
    }
    
    .iw-widgets-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .iw-mobile-user-name {
        display: block;
    }

    /* Adjust notification bell for mobile content area */
    .iw-header-actions {
        top: 90px; /* Position below sticky mobile header */
        right: 15px;
    }
}

/* Mobile Phones */
@media (max-width: 768px) {
    .iw-dashboard-content {
        padding: 15px;
    }
    .iw-content-header h1 { font-size: 24px; }
    .iw-content-header p { font-size: 14px; }
    .iw-widget-card { padding: 20px; }
    .iw-widget-icon { width: 45px; height: 45px; margin-right: 12px; }
    .iw-widget-stat { font-size: 30px; }
    .iw-content-card { padding: 20px; }
    .iw-content-card-title { font-size: 20px; }
    .iw-mobile-logo-img { max-width: 120px; }
}

/* --- CHANGE 3 & 4: Header Actions & Notification System --- */
/* This container holds the notification bell, positioned absolutely in the content area */
.iw-header-actions {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 10;
}

.iw-notification-bell {
    position: relative;
    font-size: 22px; /* Slightly larger icon */
    color: var(--color-text-light);
    cursor: pointer;
    transition: color 0.3s ease;
    width: 45px;
    height: 45px;
    background-color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.iw-notification-bell:hover {
    color: var(--color-primary);
}

.iw-notification-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background-color: var(--color-secondary);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--color-white);
}

/* Styles for when new notifications are present */
.iw-notification-bell.has-notifications {
    color: var(--color-tertiary);
    animation: iw-bell-ring 2.5s ease-in-out infinite;
    transform-origin: top center;
    box-shadow: 0 0 15px var(--color-tertiary-light);
}

@keyframes iw-bell-ring {
    0% { transform: rotate(0); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); }
    50% { transform: rotate(10deg); }
    60% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

.iw-notification-dropdown {
    display: none;
    position: absolute;
    top: 120%; /* Adjusted position */
    right: 0;
    width: 320px;
    background: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    overflow: hidden;
}

.iw-dropdown-header {
    padding: 15px;
    font-weight: 700;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    color: var(--color-primary);
}

.iw-notification-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    text-decoration: none;
    color: var(--color-text);
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f1f1f1;
}
.iw-notification-item:last-child {
    border-bottom: none;
}
.iw-notification-item:hover {
    background-color: #f8f9fa;
}

.iw-notification-item.is-empty,
.iw-notification-item.is-loading {
    justify-content: center;
    color: var(--color-text-light);
    font-style: italic;
    border-bottom: none;
}

/* --- CHANGE 2: Styles for new Floating Action Button (FAB) --- */
.iw-help-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: var(--transition);
}

.iw-help-fab:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
}

/* Z-index hierarchy for dashboard */
.iw-dashboard-sidebar {
    z-index: 1000;
}

.iw-sidebar-overlay {
    z-index: 999;
}

.iw-modal {
    z-index: 9999;
}

.iw-notification {
    z-index: 10000;
}

.iw-help-fab {
    z-index: 1000;
}

.iw-mobile-header {
    z-index: 1001;
}
