@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* === MASTER DESIGN VARIABLES === */
    --font-stack: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Surface Colors */
    --surface-ground: #f1f5f9;
    --surface-card: #ffffff;
    --surface-hover: #f8fafc;
    --surface-active: #e2e8f0;
    
    /* Typography */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Branding */
    --brand-primary: #2563eb;
    --brand-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --brand-glow: 0 8px 20px -4px rgba(37, 99, 235, 0.4);
    --brand-surface: #eff6ff;
    
    /* Functional */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    
    /* Borders & Shadows */
    --border-subtle: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
    --shadow-float: 0 20px 25px -5px rgba(15, 23, 42, 0.06), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
    
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--surface-ground);
    color: var(--text-secondary);
    font-family: var(--font-stack);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    min-height: 100vh;
}

/* === CALENDAR DRAG & DROP FIXES === */
.fc-mirror {
    z-index: 999999 !important; /* Ensure dragged item is on top of everything */
    opacity: 0.9;
    pointer-events: none; /* Let events pass through to drop targets */
    /* Restore visibility for the drag mirror which was made transparent by the general overrides below */
    background: var(--brand-primary) !important;
    color: white !important;
    border: 1px solid var(--brand-primary) !important;
    padding: 4px 12px !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5) !important;
    font-weight: 600 !important;
}

.fc-highlight {
    background: rgba(37, 99, 235, 0.15) !important; /* Distinct visual feedback for drop target */
}

.fc-daygrid-day-frame {
    cursor: pointer;
    min-height: 100px;
}

/* Ensure default FC events don't conflict with our custom pill look */
.fc-v-event, .fc-h-event {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* === AUTHENTICATION === */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top right, #dbeafe 0%, transparent 40%),
                radial-gradient(circle at bottom left, #f3e8ff 0%, transparent 40%),
                var(--surface-ground);
}
.auth-container { width: 100%; max-width: 420px; }
.auth-box {
    background: var(--surface-card);
    border-radius: var(--radius-xl);
    padding: 48px;
    box-shadow: var(--shadow-float);
    border: 1px solid #fff;
}
.auth-logo { margin-bottom: 24px; display: flex; justify-content: center; }
.auth-logo-img { max-width: 150px; height: auto; object-fit: contain; }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; letter-spacing: -0.5px; }
.auth-header p { color: var(--text-muted); font-size: 15px; }
.auth-form .form-group { margin-bottom: 24px; }
.demo-credentials {
    margin-top: 32px;
    padding: 20px;
    background: var(--surface-ground);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-subtle);
}
.demo-credentials h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.05em; }
.demo-credentials p { font-size: 13px; margin: 4px 0; font-family: monospace; color: var(--text-secondary); }
.demo-credentials strong { color: var(--brand-primary); }

/* === INTERFACE ELEMENTS === */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
input, select, textarea {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--surface-card);
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--font-stack);
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-surface);
    transform: translateY(-1px);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    font-family: var(--font-stack);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand-gradient); color: white; box-shadow: var(--brand-glow); }
.btn-primary:hover { box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.5); transform: translateY(-2px); }
.btn-secondary { background: var(--surface-card); color: var(--text-primary); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-hover); border-color: #cbd5e1; color: var(--text-primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-ghost, .ghost-btn { background: transparent; color: var(--text-secondary); padding: 8px 16px; border-radius: var(--radius-md); font-weight: 500; font-size: 13px; border: 1px solid transparent; }
.ghost-btn:hover, .btn-ghost:hover { background: rgba(0,0,0,0.03); color: var(--text-primary); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* === HEADER === */
.ux-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 16px 40px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    position: sticky;
    top: 0;
    z-index: 100;
}
.brand-cluster { display: flex; align-items: center; gap: 16px; }
.logo-chip {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    box-shadow: var(--brand-glow);
}
.brand-cluster h1 { font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.brand-cluster .eyebrow { font-size: 11px; font-weight: 600; color: var(--brand-primary); text-transform: uppercase; letter-spacing: 0.1em; }
.header-metrics { display: flex; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.status-chip {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    min-width: 150px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}
.status-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.status-chip span { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.status-chip strong { font-size: 18px; color: var(--text-primary); font-weight: 700; }
.status-chip.warning-active { border-color: var(--warning); background: #fffdf5; }
.status-chip.warning-active strong { color: var(--warning); }
.user-pill { padding: 6px 8px 6px 16px; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 50px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); }
.user-badge { width: 38px; height: 38px; border-radius: 50%; background: #e0f2fe; color: #0ea5e9; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }

/* === LAYOUT === */
.dashboard-shell { padding: 40px; max-width: 1800px; margin: 0 auto; }
.workspace-grid { display: grid; grid-template-columns: 1fr 380px; gap: 32px; }
.side-column { display: flex; flex-direction: column; gap: 24px; }

/* === PANELS === */
.panel-card {
    background: var(--surface-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-float);
    border: 1px solid #fff;
}

/* Hide Automation/Templates panel */
.action-panel { display: none !important; }

.calendar-panel { min-height: 75vh; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 28px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 20px; }
.panel-head h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.panel-head h3 { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.gradient-card { background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%); }
.glow-card { background: linear-gradient(135deg, #fffbeb 0%, #fff 100%); border-color: #fef3c7; }

/* === FILTERS === */
.filter-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
    background: white;
    border: 1px solid var(--border-subtle);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.pill:hover { transform: translateY(-1px); color: var(--text-primary); box-shadow: var(--shadow-md); }
.pill.active { background: var(--brand-primary); color: white; border-color: var(--brand-primary); box-shadow: var(--brand-glow); }
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.7; }

/* === CALENDAR STYLES === */
.calendar-surface { padding: 0; border: none; }

.calendar-empty-state {
    text-align: center;
    padding: 64px 20px;
    background: var(--surface-hover);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-subtle);
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.calendar-empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.8;
}
.calendar-empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.calendar-empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

.fc { font-family: var(--font-stack); }
.fc .fc-toolbar-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.fc .fc-button-primary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    text-transform: capitalize;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: var(--radius-md) !important;
}
.fc .fc-button-primary:hover, .fc .fc-button-primary:active, .fc .fc-button-active {
    background: var(--surface-ground) !important;
    border-color: var(--border-subtle) !important;
    color: var(--brand-primary) !important;
    box-shadow: none !important;
}
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border-subtle); }
.fc .fc-daygrid-day-number { color: var(--text-secondary); font-weight: 600; padding: 12px; }
.fc .fc-col-header-cell-cushion { color: var(--text-secondary); font-weight: 600; padding: 16px 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.fc .fc-daygrid-day.fc-day-today { background: #f8fafc !important; }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background: var(--brand-primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 4px;
}

/* === SHIFT EVENT CARD === */
.shift-event {
    background: white;
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--brand-primary);
    border-radius: 6px;
    padding: 4px 8px;
    margin: 2px 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.1s;
    color: var(--text-primary);
    font-family: var(--font-stack);
    cursor: pointer; /* Ensure click pointer is clear */
    position: relative;
    z-index: 5;
}
.shift-event:hover { transform: scale(1.02); z-index: 10; box-shadow: var(--shadow-md); }
.shift-event .time { font-size: 10px; color: var(--text-muted); font-weight: 600; }
.shift-event .employee { font-weight: 700; font-size: 12px; color: var(--text-primary); }
.shift-event.unassigned { border-style: dashed; border-left-style: solid; border-left-color: var(--warning); background: #fffbeb; }

/* === EMPLOYEE LIST === */
.search-box { margin-bottom: 24px; }

.employee-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    transition: all 0.2s;
    cursor: grab;
    user-select: none; /* Prevent text selection during drag */
}
.employee-item:active { cursor: grabbing; border-color: var(--brand-primary); }
.employee-item:hover { border-color: var(--brand-primary); box-shadow: var(--shadow-md); transform: translateX(4px); }
.employee-badge { width: 44px; height: 44px; background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%); color: var(--text-secondary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.employee-meta .employee-name { font-weight: 600; color: var(--text-primary); font-size: 14px; display: block; }
.employee-meta small { color: var(--text-muted); font-size: 12px; }

/* === MODALS === */
.modal {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 2000;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal.show { display: flex; animation: modalFadeIn 0.2s ease-out; }
.modal-content {
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.5);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}
.modal-header h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.modal-close {
    background: var(--surface-ground);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}
.modal-close:hover { background: #fee2e2; color: var(--danger); border-color: #fecaca; transform: rotate(90deg); }

/* Form Styles inside Modals */
.form-group { margin-bottom: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === TEMPLATE LIST === */
.template-item { background: white; border: 1px solid var(--border-subtle); padding: 16px; }
.template-item:hover { background: var(--brand-surface); border-color: var(--brand-primary); }

/* === TOAST === */
.toast { background: white; border: none; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .workspace-grid { grid-template-columns: 1fr; }
    .ux-header { flex-wrap: wrap; padding: 16px 20px; gap: 20px; }
    .dashboard-shell { padding: 20px; }
}
@media print {
    .ux-header, .side-column { display: none; }
    .panel-card { box-shadow: none; border: 1px solid #ccc; }
}
