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

:root {
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --glass-blur: blur(12px);
    --primary-color: #53d881;
    --primary-hover: #1abb52;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, sans-serif;
    /* A modern gradient background */
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-main);
}

p {
    padding: 0;
    margin: 0;
}

.display {
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.row.h-100 {
    height: 100%;
}

/* Glassmorphism Card Style */
.widget-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.widget-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
}

/* Custom Scrollbar for a modern look */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* Left Column Specifics */
.progress-card {
    height: auto;
    width: 100%;
    position: relative;
    padding: 10px 0;
}

.progress-head {
    display: flex;
    font-size: 14px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.percent, .finish {
    color: var(--primary-hover);
    font-weight: 700;
}

.progress-body {
    position: relative;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    overflow: hidden;
    margin: 14px 0;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #53d881, #2aa355);
    transition: width 0.4s ease;
}

.progress-side {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-top: 15px;
    color: var(--text-muted);
}
.progress-side > div {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.progress-side .num {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-hover);
}


/* Center Column Specifics */
.projects-bar {
    width: 100%;
    margin-bottom: 15px;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

.projects-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.project-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.project-btn:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.8);
}

.project-btn.active {
    border-color: var(--primary-hover);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(83, 216, 129, 0.3);
}

.project-create {
    border-style: dashed;
    color: var(--primary-hover);
}

.tasks-list, .chat-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
    overflow-y: auto;
    flex-grow: 1;
    margin-bottom: 120px; /* Space for AI widget */
}

.todo-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.todo-card:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.todo-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.todo-text {
    flex: 1;
    color: var(--text-main);
    font-size: 15px;
    word-break: break-word;
}

.todo-status {
    color: #e74c3c;
    font-size: 1.2rem;
}

.todo-card input:checked + .todo-status + .todo-text {
    color: var(--text-muted);
    text-decoration: line-through;
}

.todo-card input:checked + .todo-status {
    color: var(--primary-color);
}

.chat-card {
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
    max-width: 85%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chat-card.a {
    background: var(--primary-color);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-card.b {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-main);
    border: 1px solid rgba(83, 216, 129, 0.3);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* AI Widget Input Area */
.ai-widget {
    padding: 20px;
    border-radius: 20px;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 600px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 10;
}

.ai-toggle {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 300px;
    height: 40px;
    background: rgba(83, 216, 129, 0.2);
    border-radius: 999px;
    margin: 0 auto 15px;
}

.ai-tab {
    flex: 1;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    z-index: 2;
    transition: color 0.3s;
}

.ai-tab.active {
    color: var(--primary-hover);
}

.ai-toggle-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 8px);
    height: calc(100% - 8px);
    background: #ffffff;
    border-radius: 999px;
    transition: left 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.ai-input-wrapper {
    position: relative;
    display: flex;
}

.ai-input-wrapper input {
    width: 100%;
    height: 50px;
    border-radius: 999px;
    border: 1px solid rgba(83, 216, 129, 0.4);
    background: rgba(255, 255, 255, 0.8);
    padding: 0 60px 0 20px;
    font-size: 15px;
    outline: none;
    color: var(--text-main);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.ai-input-wrapper input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(83, 216, 129, 0.2);
}

.ai-input-wrapper input::placeholder {
    color: #95a5a6;
}

.ai-input-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 34px;
    height: 34px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    transform: translateY(-50%);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}
.ai-input-btn::before {
    content: '\2191'; /* up arrow */
    font-size: 18px;
    font-weight: bold;
}

.ai-input-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-50%) scale(1.05);
}

/* Right Column Specifics */
.widget-clock {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}
.clock {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-hover);
    display: flex;
    align-items: center;
    justify-content: center;
}
.clock .tick {
    margin: 0 5px;
    animation: blink 1s infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}

.widget-quote {
    padding: 25px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    min-height: 150px;
}
.quote {
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-main);
    font-style: italic;
}
#quote-author {
    margin-top: 10px;
    font-weight: 600;
    color: var(--primary-hover);
    font-style: normal;
}
.quote-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
}
.quote-controls button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
}
.quote-controls button:hover {
    color: var(--primary-hover);
}

.calendar {
    width: 100%;
}
.calendar__header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary-hover);
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
}
.calendar__day-names {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.4);
}
.calendar__day-numbers-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    gap: 5px;
    margin-bottom: 5px;
}
.calendar__day-number {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    width: 100%;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.calendar__day-number:hover {
    background: rgba(255,255,255,0.8);
}
.calendar__day-number--current {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
}
.calendar__day-number--current:hover {
    background: var(--primary-hover);
}

/* Modals styling for glassmorphism */
.modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}
.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.05);
}
.form-control {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
}
.form-control:focus {
    background: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(83, 216, 129, 0.25);
}


/* Bottom Navigation Bar for Mobile */
.bottom-nav {
    display: none; /* hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom); /* iOS safe area */
}

.bottom-nav ul {
    display: flex;
    justify-content: space-around;
    list-style: none;
    margin: 0;
    padding: 0;
}

.bottom-nav li {
    flex: 1;
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.2s;
}

.bottom-nav a i {
    font-size: 22px;
    margin-bottom: 4px;
}

.bottom-nav a.active {
    color: var(--primary-color);
}

/* Responsive Layout */
.col-left, .col-center, .col-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

/* Default desktop: Show all */
@media (min-width: 992px) {
    .col-left { width: 25%; }
    .col-center { width: 50%; }
    .col-right { width: 25%; }

    .container-fluid .row {
        display: flex;
        flex-wrap: nowrap;
    }
}

/* Tablet & Mobile */
@media (max-width: 991px) {
    .display {
        padding: 10px;
        padding-bottom: 80px; /* space for bottom nav */
        height: auto;
        min-height: 100vh;
    }

    .bottom-nav {
        display: block;
    }

    /* Hide all columns by default on mobile, we will show them via JS based on active tab */
    .col-left, .col-center, .col-right {
        width: 100%;
        display: none;
    }

    /* Center column (Tasks) is default active on mobile */
    .col-center.mobile-active,
    .col-left.mobile-active,
    .col-right.mobile-active {
        display: flex;
    }

    .ai-widget {
        bottom: 80px; /* above bottom nav */
        position: fixed;
        width: calc(100% - 20px);
    }

    .widget-card {
        padding: 15px;
    }
}


[data-theme="dark"] {
    --text-color: #ffffff;
    --card-bg: rgba(30, 30, 30, 0.7);
}

[data-theme="dark"] body {
    color: var(--text-color);
}

[data-theme="dark"] .widget-card,
[data-theme="dark"] .todo-card,
[data-theme="dark"] .card {
    background: var(--card-bg);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .modal-content {
    background: var(--card-bg);
    color: var(--text-color);
}
