/* ==========================================================================
   P CALENDAR PRO - COMPONENTS STYLES
   ========================================================================== */

/* Glassmorphic Header */
.header {
    height: 76px;
    background: var(--surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo-img {
    max-height: 46px;
    max-width: 140px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    background: white;
    padding: 2px;
}

.logo-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.4rem;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.logo-text span {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 1px;

    background: none;
    -webkit-text-fill-color: initial;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Master Auto SMS Toggle Switch */
.sms-toggle-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.sms-toggle-label {
    display: flex;
    flex-direction: column;
}

.sms-toggle-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    line-height: 1;
}

.sms-toggle-status {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
}

.sms-toggle-status.active {
    color: var(--success);
}

.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background: var(--primary-gradient);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Glassmorphic Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.88rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    border-color: #cbd5e1;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    opacity: 0.95;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-danger {
    background: #ef4444;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Dynamic Reminder Alert Banner */
.reminder-alert-banner {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fed7aa;
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.35s ease-out;
}

.reminder-alert-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.reminder-alert-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #ea580c;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.reminder-alert-text h4 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #9a3412;
    margin-bottom: 2px;
}

.reminder-alert-text p {
    font-size: 0.82rem;
    color: #c2410c;
}

/* App Container */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
}

/* Topbar Controls */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.month-navigation {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.month-navigation h1 {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.nav-pill-group {
    display: flex;
    background: var(--surface);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.nav-pill-group button {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-pill-group button:hover {
    color: var(--text-main);
    background: var(--bg);
}

.search-input {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    outline: none;
    font-size: 0.88rem;
    width: 260px;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

/* Filters Bar */
.filter-bar {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pill-container {
    display: flex;
    gap: 6px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.pill {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.pill.active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Analytics Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
}

.stat-card.card-jobs::before { background: var(--primary); }
.stat-card.card-revenue::before { background: var(--success); }
.stat-card.card-expenses::before { background: var(--danger); }
.stat-card.card-earnings::before { background: var(--info); }

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.stat-header small {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--bg);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

/* Main Shifting Calendar Grid */
.calendar {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.weekdays div {
    padding: 12px;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(120px, auto);
    will-change: transform, opacity;
}

.days.slide-next {
    animation: slideNext 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

.days.slide-prev {
    animation: slidePrev 0.28s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes slideNext {
    0% {
        transform: translateX(35px);
        opacity: 0.6;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slidePrev {
    0% {
        transform: translateX(-35px);
        opacity: 0.6;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.day {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    transition: var(--transition);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day:nth-child(7n) {
    border-right: none;
}

.day:hover {
    background: #f8fafc;
}

.day.other-month {
    background: #f8fafc;
    opacity: 0.4;
    cursor: default;
}

.day.today {
    background: #eef2ff;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.day-number {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-main);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.day.today .day-number {
    background: var(--primary);
    color: white;
}

/* Event Shifting Cards */
.event {
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.2s ease-out;
}

.event:hover {
    transform: scale(1.02);
}

.event-title {
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 4px;
}

.event-route {
    font-size: 0.7rem;
    opacity: 0.9;
}

.event-tags {
    display: flex;
    gap: 4px;
    margin-top: 2px;
}

.tag {
    background: rgba(255, 255, 255, 0.22);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 700;
}

.status-booked { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.status-intransit { background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%); }
.status-completed { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }

.complete-btn-quick {
    border: none;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    margin-top: 2px;
    align-self: flex-start;
    transition: var(--transition);
}

.complete-btn-quick:hover {
    background: white;
    color: var(--success);
}

/* ==========================================================================
   SIDE NAVBAR SLIDER / DRAWER (SMARTPHONE PHONE VIEW EXCLUSIVE)
   ========================================================================== */

.mobile-menu-btn {
    display: none;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    opacity: 0.95;
}

.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
    display: block;
    opacity: 1;
}

.side-drawer {
    position: fixed;
    top: 0;
    right: -360px;
    width: 330px;
    max-width: 86vw;
    height: 100vh;
    background: var(--surface);
    z-index: 1001;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 1px solid var(--border);
}

.side-drawer.active {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.drawer-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

.drawer-content {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.drawer-section {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.25rem;
}

.drawer-section:last-child {
    border-bottom: none;
}

.drawer-section-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.drawer-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.drawer-actions-stack .btn {
    width: 100%;
    justify-content: center;
}

/* ==========================================================================
   PHONE VIEW MEDIA QUERIES (@media max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    /* Fold Header controls into Side Slider on Phone View */
    .header-controls {
        display: none !important;
    }

    /* Fold Topbar desktop search & action buttons on Phone View */
    .topbar-desktop-actions {
        display: none !important;
    }

    /* Fold Stats Grid from main screen on Phone View */
    .desktop-stats-grid {
        display: none !important;
    }

    .container {
        padding: 1rem 0.75rem;
    }

    .topbar {
        margin-bottom: 1rem;
    }

    .filter-bar {
        padding: 0.75rem 1rem;
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .pill-container {
        width: 100%;
        justify-content: space-between;
    }

    .pill {
        flex: 1;
        text-align: center;
        padding: 8px 4px;
        font-size: 0.78rem;
    }

    .days {
        grid-auto-rows: minmax(85px, auto);
    }

    .day {
        padding: 4px 2px;
    }

    .event {
        padding: 4px;
        font-size: 0.68rem;
    }

    .event-route {
        display: none;
    }
}

@media (max-width: 480px) {
    .days {
        grid-auto-rows: minmax(80px, auto);
    }

    .weekdays div {
        font-size: 0.65rem;
        padding: 8px 1px;
    }

    .day-number {
        font-size: 0.75rem;
        width: 22px;
        height: 22px;
    }

    .tag {
        font-size: 0.6rem;
    }
}

@media (max-width: 380px) {
    .weekdays div span { display: none; }
    .weekdays div:nth-child(1)::after { content: 'S'; }
    .weekdays div:nth-child(2)::after { content: 'M'; }
    .weekdays div:nth-child(3)::after { content: 'T'; }
    .weekdays div:nth-child(4)::after { content: 'W'; }
    .weekdays div:nth-child(5)::after { content: 'T'; }
    .weekdays div:nth-child(6)::after { content: 'F'; }
    .weekdays div:nth-child(7)::after { content: 'S'; }
}
