/* Modern Reset & Base Styles */
:root {
    /* Float-inspired Color Palette */
    --primary: #3b82f6;
    /* Bright Blue */
    --primary-hover: #2563eb;

    --background: #ffffff;
    --background-alt: #f8fafc;
    /* Very light cool gray */

    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border: #e2e8f0;
    /* Slate 200 */

    /* Status Colors (Legacy vars, but we use classes mostly) */
    --status-plan-bg: #eff6ff;
    --status-plan-text: #3b82f6;
    --status-do-bg: #fefce8;
    --status-do-text: #eab308;
    --status-done-bg: #f0fdf4;
    --status-done-text: #22c55e;


    /* Spacing & Layout */
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background-color: var(--background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - "Float" uses a dark or light sidebar. tailored to be clean light for now */
.sidebar {
    width: var(--sidebar-width);
    background: #fdfdfd;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

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

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-link:hover {
    background: var(--background-alt);
    color: var(--text-main);
}

.sidebar-link.active {
    background: #eff6ff;
    /* Lightest blue */
    color: var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    background-color: var(--background);
    /* Main area is white */
}

.header {
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Planner Grid */
.planner-container {
    padding: 2rem;
    width: 100%;
    max-width: 100vw;
    /* Crucial: prevent it from exceeding viewport */
    overflow-x: hidden;
    /* Main container hides overflow, inner grid handles it */
    display: flex;
    flex-direction: column;
}

.week-grid {
    display: grid;
    /* Columns set by JS, but default provided */
    grid-template-columns: repeat(7, minmax(220px, 1fr));
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    width: 100%;
    /* Ensure scrollbar is visible and usable */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    padding-right: 4px;
    /* Prevent chop-off */
}

.day-column {
    background: var(--background-alt);
    border-radius: var(--radius-lg);
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

.day-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
}

.day-name {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-date {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.day-body {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Premium Task Cards */
.task-card {
    background: white;
    padding: 1rem;
    /* Slightly reduced padding */
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-bottom: 0.75rem;
    /* Reduced margin */
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    /* Reduced gap */
    position: relative;
    overflow: hidden;
    font-size: 0.85rem;
    /* Base font size reduced */
}

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

/* Status Accents */
.task-card[data-status="PLAN"] {
    border-left-color: #3b82f6;
}

.task-card[data-status="DO"] {
    border-left-color: #f59e0b;
}

.task-card[data-status="DONE"] {
    border-left-color: #10b981;
    background: #f8fafc;
    opacity: 0.8;
}

/* Typography override for card */
.task-title {
    font-size: 0.9rem;
    /* Reduced from 1rem */
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    margin-bottom: 0.15rem;
}

.task-notes {
    font-size: 0.8rem;
    /* Reduced from 0.9rem */
    color: var(--text-muted);
    background: var(--background-alt);
    padding: 0.5rem;
    /* Reduced padding */
    border-radius: var(--radius-sm);
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* pills update */
.status-pill {
    padding: 0.2rem 0.6rem;
    /* Smaller padding */
    font-size: 0.65rem;
    /* Smaller font */
    font-weight: 700;
    border-radius: 99px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}


/* Compact Column for Year View */
.week-grid.year-view .day-column {
    min-width: 150px;
    /* Narrower for year view */
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

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

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

/* Utilities */
.text-sm {
    font-size: 0.875rem;
}

.text-muted {
    color: var(--text-muted);
}

.font-bold {
    font-weight: 700;
}

.w-full {
    width: 100%;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

/* Add Tasks Button styled cleanly */
.btn-add-task {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    border-radius: var(--radius);
    margin-top: auto;
    /* Push to bottom if flex column */
    transition: all 0.2s;
}

.btn-add-task:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--status-plan-bg);
}

/* Filter Buttons */
.btn-filter {
    background: transparent;
    border: none;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-filter:hover {
    color: var(--text-main);
}

/* Authentication Pages */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--background-alt);
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Utilities for Auth */
.text-center {
    text-align: center;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.hidden {
    display: none;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #dcfce7;
}

/* GCal Style Dropdown */
.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    border-radius: var(--radius);
    font-weight: 500;
}

.btn-outline:hover {
    background: var(--background-alt);
    border-color: #dadce0;
}

/* Google Calendar Style Dropdown */
.gcal-btn {
    background: white;
    border: 1px solid #dadce0;
    color: #3c4043;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    /* GCal uses slightly sharper 4px */
    font-size: 0.875rem;
    font-weight: 500;
    height: 36px;
    cursor: pointer;
    transition: background 0.1s, box-shadow 0.1s;
}

.gcal-btn:hover {
    background: #f1f3f4;
    border-color: #dadce0;
    color: #202124;
}

.gcal-btn:active {
    background: #e8eaed;
}

.gcal-menu {
    position: absolute;
    top: 100%;
    right: 0;
    /* width: 160px; */
    min-width: 180px;
    margin-top: 4px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px 2px rgba(60, 64, 67, 0.15), 0 1px 2px 0 rgba(60, 64, 67, 0.30);
    z-index: 100;
    padding: 6px 0;
    display: none;
    animation: fadeIn 0.1s ease-out;
}

.gcal-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.875rem;
    color: #3c4043;
    cursor: pointer;
    justify-content: space-between;
}

.gcal-item:hover {
    background: #f1f3f4;
}

.gcal-item.selected {
    color: #1967d2;
    background: #e8f0fe;
    font-weight: 500;
}

.gcal-item .check {
    opacity: 0;
    color: #1967d2;
    margin-left: 8px;
}

.gcal-item.selected .check {
    opacity: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.1s;
}

.dropdown-item:hover {
    background: var(--background-alt);
}

/* --- Team View Overhaul (Glass Pane) --- */

/* Layout & Search */
.team-header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    width: 300px;
    max-width: 100%;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding-left: 2.25rem;
    border-radius: 99px;
    /* Pill shape */
    border: 1px solid var(--border);
    background: white;
    transition: all 0.2s;
}

.search-input:focus {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
}

/* User Table */
.glass-table-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
}

.glass-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.5);
}

.glass-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: background 0.1s;
}

.glass-table tr:last-child td {
    border-bottom: none;
}

.glass-table tr:hover td {
    background: #f8fafc;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #60a5fa);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    flex-shrink: 0;
}

.avatar.admin-avatar {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    /* Purple for admin */
}

/* Actions Menu */
.action-btn {
    padding: 0.4rem;
    color: var(--text-muted);
    border-radius: var(--radius);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.action-btn:hover {
    background: var(--background-alt);
    color: var(--text-main);
}

/* Slide-out Drawer */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    /* Dim background */
    backdrop-filter: blur(2px);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 500px;
    max-width: 90vw;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.drawer.open {
    transform: translateX(0);
}

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

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.drawer-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: white;
}