:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #8b5cf6;
    --accent: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-family: 'Outfit', sans-serif;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

#app {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    position: relative;
    padding: 20px;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

.screen.hidden {
    display: none;
}

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

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

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Welcome Screen */
.welcome-card {
    text-align: center;
    padding: 40px;
}

.welcome-header {
    margin-bottom: 32px;
}

.welcome-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
select:focus {
    border-color: var(--primary);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f8fafc' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

select option {
    background: var(--bg-color);
    color: var(--text-main);
}

/* select.highlight-red { */
/*for reminder select*/
/* color: #ef4444 !important; */
/* } */

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    padding: 14px;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, opacity 0.2s;
    margin-top: 10px;
}

.primary-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.message {
    font-size: 0.9rem;
    min-height: 20px;
}

.error-message {
    color: var(--error);
}

.success-message {
    color: var(--success);
}

/* Dashboard Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--error);
}

.greeting h2 {
    font-size: 2rem;
    font-weight: 600;
}

.date-display {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}

/* Sync Status */
.sync-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: background-color 0.3s;
}

.sync-status.synced {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.sync-status.syncing {
    background-color: var(--warning);
    animation: pulse 1s infinite;
}

.sync-status.error {
    background-color: var(--error);
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Task Input */
.task-input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
}

.input-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#new-task-input {
    width: 100%;
}

#task-notes-input {
    font-size: 0.9rem;
    color: var(--text-muted);
}

#task-date-input,
#task-time-input,
#reminder-select {
    flex: 1;
    min-width: 120px;
}

/* Add visual icons for date, time, and reminder inputs */
#task-date-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%2394a3b8' d='M208 32h-24v-8a8 8 0 0 0-16 0v8H88v-8a8 8 0 0 0-16 0v8H48a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16M72 48v8a8 8 0 0 0 16 0v-8h80v8a8 8 0 0 0 16 0v-8h24v32H48V48Zm136 160H48V96h160z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px 16px;
    padding-left: 36px;
}

#task-time-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%2394a3b8' d='M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24m0 192a88 88 0 1 1 88-88a88.1 88.1 0 0 1-88 88m64-88a8 8 0 0 1-8 8h-56a8 8 0 0 1-8-8V72a8 8 0 0 1 16 0v48h48a8 8 0 0 1 8 8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 16px 16px;
    padding-left: 36px;
}

#reminder-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%2394a3b8' d='M221.8 175.94c-5.55-9.56-13.8-36.61-13.8-71.94a80 80 0 1 0-160 0c0 35.34-8.26 62.38-13.81 71.94A16 16 0 0 0 48 200h40.81a40 40 0 0 0 78.38 0H208a16 16 0 0 0 13.8-24.06M128 216a24 24 0 0 1-22.62-16h45.24A24 24 0 0 1 128 216m-80-32c7.7-13.24 16-43.92 16-80a64 64 0 1 1 128 0c0 36.05 8.28 66.73 16 80Z'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23f8fafc' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: left 12px center, right 12px center;
    background-size: 16px 16px, 12px 12px;
    padding-left: 36px;
}

#add-task-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.2s;
}

#add-task-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    position: relative;
    transition: color 0.2s;
}

.tab-btn.active {
    color: var(--text-main);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Task List */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 40px;
}

.task-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    align-items: flex-start;
    /* Changed to flex-start for notes */
    gap: 12px;
    transition: background 0.2s;
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-top: 2px;
    /* Align with text */
}

.task-item.completed .task-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.task-checkbox i {
    color: white;
    font-size: 14px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.task-item.completed .task-checkbox i {
    opacity: 1;
    transform: scale(1);
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.task-text {
    font-size: 1rem;
    transition: color 0.2s;
}

.task-item.completed .task-text {
    color: var(--text-muted);
    text-decoration: line-through;
}

.task-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.task-time,
.task-reminder {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.task-reminder {
    color: var(--accent);
}

.task-notes {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
    align-self: flex-start;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    font-size: 1.1rem;
    margin-top: 2px;
}

.task-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--error);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* History Controls */
.history-controls {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.view.hidden {
    display: none;
}

/* Desktop Grid Layout */
@media (min-width: 900px) {
    .tabs {
        display: none;
        /* Hide tabs on desktop */
    }

    .views-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
        align-items: start;
    }

    .view {
        display: block !important;
        /* Always show both views */
    }

    .view.hidden {
        display: block !important;
    }

    .view-header {
        display: block;
        /* Show headers on desktop */
    }

    /* Adjust history controls for side column */
    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .history-controls input[type="date"] {
        width: 100%;
    }
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    #app {
        padding: 0;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #welcome-screen.active {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        width: 100%;
    }

    #dashboard-screen.active {
        display: block;
        width: 100%;
        align-self: flex-start;
    }

    .glass-card {
        padding: 16px;
        border-radius: 16px;
    }

    .welcome-card {
        padding: 24px;
        margin: 20px;
        width: calc(100% - 40px);
        max-width: 400px;
    }

    .welcome-header h1 {
        font-size: 2rem;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
        background: var(--card-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--glass-border);
    }

    .greeting h2 {
        font-size: 1.5rem;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .date-display {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .task-input-container {
        padding: 12px;
        margin: 12px 8px;
    }

    .input-actions {
        gap: 8px;
    }

    input[type="text"],
    input[type="date"],
    input[type="time"],
    select {
        font-size: 16px;
        padding: 12px;
    }

    #task-date-input,
    #task-time-input {
        flex: 1;
        min-width: calc(50% - 4px);
    }

    #reminder-select {
        flex: 1 1 100%;
        width: 100%;
    }

    #add-task-btn {
        width: 48px;
        height: 48px;
    }

    .tabs {
        padding: 0 16px 12px;
    }

    .tasks-list {
        padding: 0 8px 60px;
    }

    .task-item {
        padding: 14px;
    }

    .delete-btn {
        opacity: 1;
    }

    .history-controls {
        flex-direction: column;
        align-items: stretch;
        margin: 12px 8px;
    }

    .history-controls input[type="date"] {
        width: 100%;
    }
}

@media (max-width: 375px) {
    .welcome-header h1 {
        font-size: 1.75rem;
    }

    .greeting h2 {
        font-size: 1.3rem;
    }

    #task-date-input,
    #task-time-input {
        min-width: 100%;
    }
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.7rem;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--glass-border);
    z-index: 1000;
}

.app-footer p {
    margin: 2px 0;
}

/* Forgot PIN Link */
.forgot-pin-link {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: none;
    margin-top: 16px;
    transition: color 0.2s;
}

.forgot-pin-link:hover {
    color: var(--primary);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    position: relative;
    z-index: 10000;
    max-width: 450px;
    width: 100%;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    font-size: 1.2rem;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--error);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

/* Mobile Modal Adjustments */
@media (max-width: 600px) {
    .modal {
        padding: 16px;
    }

    .modal-content {
        max-width: 100%;
    }

    .modal-header h2 {
        font-size: 1.3rem;
    }
}

/* Text Button (for updates) */
.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px 8px;
    margin-top: 8px;
    text-decoration: underline;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.text-btn:hover {
    opacity: 1;
}

.text-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: none;
}

/* Task Status Badge/Select */
.task-status {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    outline: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    width: auto;
    min-width: 90px;
    margin-top: 4px;
}

.task-status.not-started {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.task-status.preparing {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.task-status.postpone {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.task-status.kiv {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.task-status.done {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.task-status:hover {
    filter: brightness(1.2);
}