:root {
    --primary-color: #4a6cf7;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --light-color: #f9fafb;
    --dark-color: #1f2937;
    --body-bg: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --header-height: 60px;
    --bottom-nav-height: 56px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--dark-color);
}

/* New Layout System */
.app-header {
    height: var(--header-height);
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1020;
}

.app-header-brand {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.main-content {
    width: 100%;
    padding: 16px;
    padding-top: calc(var(--header-height) + 16px);
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: #ffffff;
    border-top: 1px solid #e6e7eb;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1020;
    box-shadow: 0 -6px 16px rgba(17, 24, 39, 0.05);
}

.bottom-nav-item {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: #111111;
    font-size: 11px;
    padding: 6px 0;
    transition: color 0.2s ease;
}

.bottom-nav-item i {
    display: block;
    font-size: 18px;
    margin-bottom: 3px;
    color: #111111;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: #111111;
    text-decoration: none;
    font-weight: 600;
}

/* Responsive tweaks */
@media (min-width: 992px) {

    /* On desktop, give more breathing room but keep bottom nav visible */
    .main-content {
        padding: 12px 20px;
        padding-top: calc(var(--header-height) + 12px);
        padding-bottom: calc(var(--bottom-nav-height) + 12px);
    }
    
    /* Compact header */
    .header {
        margin-bottom: 12px !important;
    }
    
    .header-title {
        font-size: 20px !important;
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: 14px;
        padding-top: calc(var(--header-height) + 12px);
        padding-bottom: calc(var(--bottom-nav-height) + 12px);
    }

    .app-header {
        padding: 0 12px;
        height: 54px;
    }

    .header {
        gap: 10px;
    }

    .header-title {
        font-size: 1.35rem;
    }

    .btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.875rem;
    }

    .card-body {
        padding: 0.9rem;
    }
}

/* Page Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-title {
    font-weight: 700;
    font-size: 1.75rem;
    margin: 0;
    color: var(--dark-color);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
    margin-bottom: 16px;
    border: none;
}

.card-header {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-color);
}

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

.form-label,
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    display: block;
    width: 100%;
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(74, 108, 247, 0.25);
}

textarea.form-control {
    height: auto;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #3a55e2;
    border-color: #3a55e2;
}

/* Tables */
.table {
    border-collapse: collapse;
    width: 100%;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 0.8rem;
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table tbody td {
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: var(--light-color);
}

.card-body.p-0 .table {
    margin-bottom: 0;
}

.card-body.p-0 .table tr:first-child td {
    border-top: none;
}

/* Ensure tables scroll on small screens */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    min-width: 600px;
}


/* Alerts / Flash Messages */
.flash-messages-container {
    margin-bottom: 1.5rem;
}

/* Header button group wrapping for mobile */
.header .btn-group {
    flex-wrap: wrap;
    gap: 8px;
}

.header .btn-group .btn {
    margin-right: 0;
}

/* Icon Shapes for Dashboards */
.icon-shape {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
}

.icon-shape i {
    font-size: 1.5rem;
}

/* Task Type Badges (used in several places) */
.badge.type-poster {
    background-color: #dbeafe;
    color: #3b82f6;
}

.badge.type-reel {
    background-color: #fce7f3;
    color: #db2777;
}

.badge.type-blog {
    background-color: #def7ec;
    color: #059669;
}

/* Priority Badges */
.badge.priority-low {
    background-color: #e2f5e9;
    color: #10b981;
}

.badge.priority-medium {
    background-color: #fbf3e2;
    color: #f59e0b;
}

.badge.priority-high {
    background-color: #fee2e2;
    color: #ef4444;
}

.badge.priority-urgent {
    background-color: #7f1d1d;
    color: #fff;
}

/* Status Badges */
.badge-pending,
.badge-draft {
    background-color: #e5e7eb;
    color: #4b5563;
}

.badge-in-progress,
.badge-sent {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-review,
.badge-on-hold {
    background-color: #ffedd5;
    color: #9a3412;
}

.badge-approved,
.badge-active,
.badge-paid {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-completed,
.badge-done,
.badge-inactive {
    background-color: #e5e7eb;
    color: #4b5563;
}

.badge-rejected,
.badge-overdue {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Notification toasts */
.notification {
    position: fixed;
    right: 16px;
    bottom: 16px;
    display: flex;
    align-items: center;
    background: var(--card-bg);
    color: var(--dark-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    padding: 10px 12px;
    min-width: 260px;
    max-width: 90vw;
    opacity: 0;
    transform: translateY(10px);
    transition: all .25s ease;
    z-index: 2000;
}

.notification+.notification {
    margin-top: 10px;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification-icon {
    margin-right: 10px;
    font-size: 18px;
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-warning {
    border-left: 4px solid var(--warning-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
}

.notification-info {
    border-left: 4px solid var(--info-color);
}

.notification-close {
    background: none;
    border: 0;
    margin-left: 8px;
    font-size: 18px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

/* Attendance heatmap basic styles (if used) */
.heatmap-row {
    display: grid;
    grid-template-columns: 90px repeat(12, minmax(20px, 1fr));
    gap: 4px;
    align-items: center;
}

.heatmap-cell {
    height: 18px;
    border-radius: 3px;
}

.heatmap-label {
    font-size: 12px;
    color: var(--secondary-color);
    align-self: center;
}

.heatmap-month {
    text-align: center;
    font-weight: 600;
    font-size: 12px;
}

.heatmap-value {
    background: #e5e7eb;
}

.heatmap-level-0 {
    background: #f3f4f6;
}

.heatmap-level-1 {
    background: #d1fae5;
}

.heatmap-level-2 {
    background: #a7f3d0;
}

.heatmap-level-3 {
    background: #6ee7b7;
}

.heatmap-level-4 {
    background: #34d399;
}

@media (max-width: 767.98px) {
    .heatmap-row {
        grid-template-columns: 70px repeat(12, 1fr);
    }
}

/* ================================
   Mobile-First Responsive Utilities
   ================================ */

/* Responsive Grid System */
.row-mobile-stack {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.row-mobile-stack>[class*="col-"] {
    padding: 0 8px;
    margin-bottom: 16px;
}

@media (max-width: 767.98px) {
    .row-mobile-stack>[class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Mobile-First Card Grid */
.card-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Stats Grid - Mobile First */
.stats-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

/* Touch-Friendly Buttons */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    font-size: 16px;
}

@media (max-width: 575.98px) {
    .btn {
        min-height: 44px;
        padding: 10px 16px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }

    .btn-lg {
        min-height: 52px;
        padding: 14px 24px;
        font-size: 18px;
    }
}

/* Mobile Forms */
@media (max-width: 575.98px) {
    .form-control {
        height: 48px;
        font-size: 16px;
        padding: 12px 14px;
    }

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

    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    select.form-control {
        height: 48px;
        padding: 12px 14px;
    }
}

/* Mobile Header Adjustments */
@media (max-width: 575.98px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-title {
        font-size: 1.5rem;
    }

    .header .btn-group,
    .header .d-flex {
        width: 100%;
        flex-wrap: wrap;
    }

    .header .btn {
        flex: 1;
        min-width: 100px;
    }
}

/* Mobile Tables */
.table-mobile-card {
    display: block;
}

@media (max-width: 767.98px) {
    .table-mobile-card thead {
        display: none;
    }

    .table-mobile-card tbody tr {
        display: block;
        padding: 16px;
        margin-bottom: 12px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .table-mobile-card tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border: none;
        border-bottom: 1px solid #f3f4f6;
    }

    .table-mobile-card tbody td:last-child {
        border-bottom: none;
    }

    .table-mobile-card tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 12px;
        text-transform: uppercase;
    }
}

/* Mobile Spacing Utilities */
@media (max-width: 575.98px) {
    .mb-mobile-3 {
        margin-bottom: 16px !important;
    }

    .mb-mobile-4 {
        margin-bottom: 24px !important;
    }

    .p-mobile-3 {
        padding: 16px !important;
    }

    .px-mobile-3 {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* Hide/Show Utilities */
.d-mobile-none {
    display: block;
}

.d-mobile-block {
    display: none;
}

@media (max-width: 767.98px) {
    .d-mobile-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }
}

.d-desktop-none {
    display: none;
}

@media (min-width: 992px) {
    .d-desktop-none {
        display: none !important;
    }

    .d-desktop-block {
        display: block !important;
    }
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(74, 108, 247, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

@media (min-width: 992px) {
    .fab {
        display: none;
    }
}

/* Pull to Refresh Indicator */
.pull-indicator {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: white;
    padding: 12px 24px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.pull-indicator.show {
    transform: translateX(-50%) translateY(0);
}

/* Empty State - Mobile Optimized */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon i {
    font-size: 32px;
    color: #9ca3af;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: 12px;
}

/* Swipe Actions (for lists) */
.swipe-container {
    overflow: hidden;
    position: relative;
}

.swipe-item {
    position: relative;
    transition: transform 0.3s ease;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    display: flex;
    transform: translateX(100%);
}

.swipe-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    color: white;
    font-weight: 600;
}

.swipe-action-delete {
    background: #ef4444;
}

.swipe-action-edit {
    background: #3b82f6;
}

/* Bottom Sheet Modal */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1060;
    max-height: 90vh;
    overflow-y: auto;
}

.bottom-sheet.show {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 12px auto;
}

.bottom-sheet-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bottom-sheet-title {
    font-size: 18px;
    font-weight: 600;
}

.bottom-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bottom-sheet-body {
    padding: 20px;
}

/* Chip/Tag Mobile Styles */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.chip-primary {
    background: #eff6ff;
    color: #3b82f6;
}

.chip-success {
    background: #d1fae5;
    color: #059669;
}

.chip-warning {
    background: #fef3c7;
    color: #d97706;
}

.chip-danger {
    background: #fee2e2;
    color: #dc2626;
}

/* Scroll Snap for Horizontal Cards */
.scroll-snap-x {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

.scroll-snap-x::-webkit-scrollbar {
    display: none;
}

.scroll-snap-x>* {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* Safe Area Padding */
.safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom, 20px);
}

.safe-area-top {
    padding-top: env(safe-area-inset-top, 0);
}