/* ====================================================================
   TaskScheduler Pro - Modern Light Theme Stylesheet
   ==================================================================== */

:root {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f1f5f9;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);

    --success: #10b981;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;

    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;

    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;

    --info: #06b6d4;
    --info-light: #ecfeff;

    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --sidebar-width: 260px;
    --topbar-height: 68px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;
}

/* Global Typography & Reset */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}
a:hover {
    color: var(--primary-hover);
}

/* Layout Architecture */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Modern Light Sidebar */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1020;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.sidebar-menu {
    padding: 1.25rem 0.85rem;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-subtle);
    padding: 0.5rem 0.85rem;
    margin-top: 0.75rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.95rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar-nav-item i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

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

.sidebar-nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.sidebar-nav-item.active i {
    color: var(--primary);
}

.sidebar-user-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background-color: #fafbfc;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
}

.avatar-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* Sticky Top Navigation Bar */
.app-topbar {
    height: var(--topbar-height);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
}

.topbar-search {
    position: relative;
    max-width: 380px;
    width: 100%;
}
.topbar-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-subtle);
}
.topbar-search .form-control {
    padding-left: 2.5rem;
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface-secondary);
    border: 1px solid transparent;
    font-size: 0.9rem;
}
.topbar-search .form-control:focus {
    background-color: var(--bg-surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Page Container */
.page-container {
    padding: 1.75rem;
    flex: 1;
}

/* Modern Rounded Cards */
.card-custom {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.card-custom-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-custom-body {
    padding: 1.5rem;
}

/* Stat Cards */
.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}
.stat-card-number {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
}
.stat-card-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Priority Badges */
.priority-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
}
.priority-low {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.priority-medium {
    background-color: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
}
.priority-high {
    background-color: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}
.priority-critical {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    animation: subtle-pulse 2s infinite ease-in-out;
}

@keyframes subtle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Completed Task Specific Styling */
.task-row-completed {
    background-color: #f8fafc;
}
.task-row-completed .task-title {
    text-decoration: line-through;
    color: var(--success) !important;
    font-weight: 500;
}
.task-row-completed .task-completed-icon {
    color: var(--success);
    margin-right: 0.35rem;
}

/* Custom Table Styles */
.table-custom {
    width: 100%;
    margin-bottom: 0;
    vertical-align: middle;
}
.table-custom th {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
}
.table-custom td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.92rem;
}
.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.1rem;
    transition: all 0.2s ease;
}
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-pill {
    border-radius: var(--radius-pill);
}

/* Modern Form Controls */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: #ffffff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Follow-up Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}
.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: var(--primary);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--primary);
}

/* Attachment Card */
.attachment-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}
.attachment-card:hover {
    border-color: var(--primary);
    box-shadow: var(--card-shadow);
}
.attachment-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
}

/* Mobile Sidebar Backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1015;
}

/* Responsive Breakpoints */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .sidebar-backdrop.show {
        display: block;
    }
    .app-main {
        margin-left: 0;
    }
    .page-container {
        padding: 1.25rem 1rem;
    }
}

/* Print Optimization */
@media print {
    .app-sidebar, .app-topbar, .btn, .no-print, .pagination, .filters-container {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
    }
    .page-container {
        padding: 0 !important;
    }
    .card-custom {
        border: none !important;
        box-shadow: none !important;
    }
}
