/* Modern Moon Calendar Styles */
:root {
    /* Color Palette - Mystic Night / Dark Mode Default */
    --bg-primary: #0b0f19;
    --bg-secondary: #131a2a;
    --bg-panel: rgba(19, 26, 42, 0.7);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    /* Silver & Lunar Palette */
    --accent-gold: #cbd5e1;
    /* Reassigned to Silver */
    --accent-blue: #94a3b8;
    /* Slate / Moon Grey */
    --accent-purple: #f8fafc;
    /* Bright Moon White */
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(19, 26, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.05);

    /* Typography */
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-serif: 'Crimson Pro', serif;
    --font-devanagari: 'Noto Sans Devanagari', sans-serif;

    /* Spacing & Sizes */
    --sidebar-width: 380px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-panel: rgba(255, 255, 255, 0.85);
    --text-main: #0f172a;
    --text-muted: #475569;
    /* Silver & Lunar Palette - Light Mode */
    --accent-gold: #64748b;
    /* Reassigned to Darker Silver */
    --accent-blue: #475569;
    /* Dark Slate */
    --accent-purple: #1e293b;
    /* Deep Moon Grey */
    --border-color: rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
}

/* Base Styles & Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    transition: background-color 0.4s ease, color 0.4s ease;
    background-image: radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
}

.hindi-text {
    font-family: var(--font-devanagari);
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Main Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* --- MAIN CALENDAR AREA --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem;
    overflow-y: auto;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    border-radius: var(--radius-lg);
    margin: 0.5rem;
}

/* Header */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    z-index: 10;
    padding-right: 0;
    transition: padding-right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-open .calendar-header {
    padding-right: var(--sidebar-width);
}

.header-title h1 {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-main), var(--accent-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.header-title p {
    color: var(--text-muted);
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.vortex-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.vortex-link:hover {
    color: var(--text-main);
    border-color: var(--accent-gold);
    box-shadow: 0 0 12px rgba(203, 213, 225, 0.15);
}

.header-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-group {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    border: 1px solid var(--border-color);
}

.icon-btn,
.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.nav-btn.text-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    background: var(--text-main);
    color: var(--bg-primary) !important;
}

.text-btn:hover {
    background: var(--accent-gold);
    color: var(--bg-primary) !important;
}

.icon-btn:hover,
.nav-btn:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.today-btn {
    background: var(--accent-purple);
    color: white;
}

.today-btn:hover {
    background: #7c3aed;
    color: white;
}

.actions-group {
    display: flex;
    gap: 0.5rem;
}

/* Calendar Grid */
.calendar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: min-content;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
}

.weekday {
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.days-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr;
    gap: 0.75rem;
    padding: 1rem;
    flex: 1;
}

/* --- CONTEXT MENU / TOAST (ADDED FROM CLEAN STYLE) --- */
.context-menu {
    position: absolute;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    min-width: 150px;
}

.context-menu.hidden {
    display: none;
}

.context-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #f8fafc;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.context-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.context-item i {
    color: var(--accent-gold);
    width: 16px;
    text-align: center;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-panel);
    border: 1px solid var(--accent-purple);
    color: var(--text-main);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    font-weight: 500;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    color: #10b981;
    font-size: 1.25rem;
}

.day-cell {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    position: relative;
    overflow: hidden;
}

.day-cell:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--accent-blue);
    z-index: 5;
}

[data-theme="light"] .day-cell:hover {
    background: rgba(0, 0, 0, 0.02);
}

.day-cell.other-month {
    opacity: 0.4;
}

.day-cell.today {
    border: 2px solid var(--accent-purple);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(139, 92, 246, 0.1));
}

.day-cell.active-selection {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: auto;
}

.day-number {
    font-size: 1.5rem;
    font-weight: 600;
    font-family: var(--font-serif);
}

.tithi-label {
    font-size: 0.70rem;
    color: var(--text-muted);
    text-align: right;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges and Indicators */
.day-indicators {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.festival-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    margin-top: 4px;
    width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.2;
}

[data-theme="light"] .festival-badge {
    background: rgba(100, 116, 139, 0.12);
    color: #64748b;
}

.moon-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.8rem;
    color: var(--accent-gold);
}

.note-dots {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.dot.note {
    background: var(--accent-blue);
}

.dot.task {
    background: var(--accent-purple);
}


/* --- SIDEBAR PANEL --- */
.details-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-panel);
    border-left: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
}

.details-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.selected-date-display h2 {
    font-size: 3.5rem;
    font-family: var(--font-serif);
    line-height: 1;
    background: linear-gradient(135deg, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.selected-date-display p {
    color: var(--accent-gold);
    font-weight: 500;
    margin-top: 0.5rem;
    font-size: 1.1rem;
}

.sidebar-content {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Panchang Cards */
.panchang-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-card.festival {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.1), transparent);
    border-color: rgba(148, 163, 184, 0.3);
}

.card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Sections (Notes / Tasks) */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.add-btn:hover {
    background: var(--accent-purple);
    color: white;
    border-color: var(--accent-purple);
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
}

.list-item {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    transition: transform 0.2s;
}

.list-item:hover {
    transform: translateX(4px);
    border-color: var(--text-muted);
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.delete-btn:hover {
    color: #ef4444;
}

/* Checkbox Styling */
input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

input[type="checkbox"]:checked {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.modern-input,
.modern-select,
.modern-textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.modern-textarea {
    resize: vertical;
    min-height: 100px;
}

.modern-input:focus,
.modern-select:focus,
.modern-textarea:focus {
    outline: none;
    border-color: var(--accent-purple);
}

/* Modal specific grid for Jump Date */
.jump-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}

.btn-primary {
    background: var(--accent-purple);
    color: var(--bg-primary);
    /* Use background color for contrast */
}

.btn-primary:hover {
    background: #7c3aed;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Responsive */
@media (max-width: 1024px) {
    .details-sidebar {
        width: 320px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .header-title h1 {
        font-size: 2rem;
    }

    .weekdays,
    .days-grid {
        gap: 0.5rem;
    }

    .day-cell {
        padding: 0.5rem;
    }

    .day-number {
        font-size: 1.2rem;
    }

    .tithi-label {
        display: none;
        /* Hide tithi text on mobile to save space */
    }

    .details-sidebar {
        width: 100%;
    }
}

/* --- FOOTER --- */
.app-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    z-index: 10;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.app-footer a:hover {
    color: var(--text-main);
}

.app-footer .dot {
    opacity: 0.4;
    margin: 0 0.15rem;
}

.app-footer .footer-divider {
    opacity: 0.3;
    margin: 0 0.5rem;
}

.app-footer .footer-credits i {
    font-size: 0.95rem;
    margin-left: 0.4rem;
    color: var(--text-muted);
    transition: color 0.2s;
    vertical-align: middle;
}

.app-footer .footer-credits a:hover i {
    color: var(--accent-gold);
}

@media (max-width: 768px) {
    .app-footer {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .app-footer .footer-divider {
        display: none;
    }
}