/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --mwc-primary: #3b82f6;
    /* Modern Blue */
    --mwc-primary-hover: #2563eb;
    --mwc-bg: #ffffff;
    --mwc-bg-secondary: #f8fafc;
    --mwc-text-main: #1e293b;
    --mwc-text-muted: #64748b;
    --mwc-border: #e2e8f0;
    --mwc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --mwc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --mwc-radius: 12px;
    --mwc-radius-sm: 8px;
    --mwc-slot-height: 60px;
    /* 1 hour height */
}

#mwc-calendar-app {
    font-family: 'Inter', sans-serif;
    max-width: 1200px;
    margin: 40px auto;
    background: var(--mwc-bg);
    border-radius: var(--mwc-radius);
    box-shadow: var(--mwc-shadow);
    overflow: hidden;
    border: 1px solid var(--mwc-border);
    color: var(--mwc-text-main);
    box-sizing: border-box;
}

#mwc-calendar-app *,
#mwc-calendar-app *::before,
#mwc-calendar-app *::after {
    box-sizing: inherit;
}

/* Header */
.mwc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--mwc-border);
    background: var(--mwc-bg);
}

.mwc-title h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.mwc-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mwc-btn {
    padding: 10px 16px;
    border-radius: var(--mwc-radius-sm);
    border: 1px solid var(--mwc-border);
    background: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: var(--mwc-text-main);
}

.mwc-btn:hover {
    background: var(--mwc-bg-secondary);
    border-color: #cbd5e1;
}

.mwc-btn-primary {
    background: var(--mwc-primary);
    color: white;
    border: none;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.mwc-btn-primary:hover {
    background: var(--mwc-primary-hover);
    transform: translateY(-1px);
}

/* Calendar Grid - Modern Sticky Layout */
.mwc-grid-container {
    display: grid;
    grid-template-columns: 70px repeat(7, minmax(120px, 1fr));
    /* Fixed Time col + 7 Flex Days */
    grid-template-rows: auto 1fr;
    overflow: auto;
    max-height: 700px;
    position: relative;
    background: white;
    scroll-behavior: smooth;
    border-top: 1px solid var(--mwc-border);
}

/* Header Cells (Sticky Top) */
.mwc-day-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--mwc-bg-secondary);
    border-bottom: 1px solid var(--mwc-border);
    border-left: 1px solid var(--mwc-border);
    padding: 16px 8px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Corner Cell (Top Left) */
.mwc-corner-cell {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 40;
    background: var(--mwc-bg-secondary);
    border-bottom: 1px solid var(--mwc-border);
    border-right: 1px solid var(--mwc-border);
}

/* Time Sidebar (Sticky Left) */
.mwc-time-sidebar {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    left: 0;
    z-index: 20;
    background: var(--mwc-bg);
    border-right: 1px solid var(--mwc-border);
}

.mwc-time-slot-label {
    height: var(--mwc-slot-height);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--mwc-text-muted);
    transform: translateY(-50%);
    padding-top: 4px;
}

/* Main Grid Body (Columns) */
.mwc-day-column {
    grid-row: 2;
    position: relative;
    border-left: 1px solid var(--mwc-border);
    background: repeating-linear-gradient(to bottom,
            transparent,
            transparent calc(var(--mwc-slot-height) - 1px),
            var(--mwc-border) calc(var(--mwc-slot-height) - 1px),
            var(--mwc-border) var(--mwc-slot-height));
    height: calc(var(--mwc-slot-height) * 24);
    /* Full Day Height */
    min-width: 120px;
}

/* Events */
.mwc-event {
    position: absolute;
    left: 4px;
    right: 4px;
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--mwc-primary);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 0.8rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.mwc-event:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 15;
    background: rgba(59, 130, 246, 0.25);
}

.mwc-event-title {
    font-weight: 600;
    color: #1e40af;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mwc-event-time {
    font-size: 0.7rem;
    color: #3b82f6;
    display: block;
}

/* Modal */
.mwc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.mwc-modal-overlay.open {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.mwc-modal {
    background: white;
    padding: 32px;
    border-radius: var(--mwc-radius);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--mwc-shadow-lg);
    position: relative;
    animation: slideUp 0.3s ease;
}

.mwc-modal-header h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.25rem;
}

.mwc-form-group {
    margin-bottom: 16px;
}

.mwc-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.mwc-form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--mwc-border);
    border-radius: var(--mwc-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: border 0.2s;
}

.mwc-form-group input:focus {
    outline: none;
    border-color: var(--mwc-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.mwc-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Toast */
.mwc-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: var(--mwc-radius-sm);
    box-shadow: var(--mwc-shadow-lg);
    display: none;
    z-index: 10000;
    font-size: 0.9rem;
}

.mwc-toast.error {
    background: #ef4444;
}

.mwc-toast.success {
    background: #10b981;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Loading */
.mwc-loading {
    padding: 40px;
    text-align: center;
    color: var(--mwc-text-muted);
}