:root {
    /* Цветовая палитра - iOS Dark Mode */
    --bg-main: #000000;
    --bg-card: rgba(255, 255, 255, 0.08);
    --bg-nav: rgba(18, 18, 20, 0.85);
    
    --text-primary: #FFFFFF;
    --text-secondary: #EBEBF599; /* iOS Secondary Label */
    
    --accent: #0A84FF; /* iOS Blue */
    
    /* Цвета целей (iOS Palette) */
    --color-career: #5E5CE6; /* Indigo */
    --color-health: #32ADE6; /* Cyan */
    --color-study:  #0A84FF; /* Blue */
    --color-self:   #FF9F0A; /* Orange */
    --color-custom: #FF375F; /* Pink */

    --border: rgba(255, 255, 255, 0.15);
    --radius: 16px;
    --font-main: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow: hidden;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 44px 20px 16px; /* Больше отступ сверху для iOS челки */
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10;
    border-bottom: 0.5px solid var(--border);
}

.date-info h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.date-info span {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-container {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex-grow: 1;
    height: 6px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 90px;
    position: relative;
    scroll-behavior: smooth;
    padding-top: 16px;
}

.view {
    display: none;
    padding: 0 16px; /* Боковые отступы */
    animation: fadeIn 0.3s ease;
}

.view.active-view {
    display: block;
}

/* Timeline Container */
.timeline-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px; /* Монолитная сетка с тонкими зазорами */
}

/* Current time line slides over the cards */
.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #FF453A; /* iOS Red */
    z-index: 20;
    pointer-events: none;
    transition: top 1s linear;
    box-shadow: 0 0 8px rgba(255, 69, 58, 0.5);
}

.current-time-badge {
    display: none;
}

/* Timeline Item (States) */
.timeline-item {
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: center;
}

.timeline-item:active {
    transform: scale(0.97);
}

.timeline-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--item-color, var(--accent));
}

/* Past Tasks */
.is-past .timeline-card {
    opacity: 0.4;
    filter: grayscale(0.5);
    background: transparent;
}

/* Future Tasks */
.is-future .timeline-card {
    opacity: 0.8;
}

/* Active Task (Focus Mode) */
.is-active {
    margin: 12px 0; /* Раздвигаем соседей */
    z-index: 10;
}
.is-active .timeline-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: 4px solid var(--item-color, var(--accent));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(1.02);
}

.card-time-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.card-goal {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--item-color, var(--accent));
}

.timeline-card h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.4px;
    margin-bottom: 4px;
}

.focus-label {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.status-icon {
    font-size: 16px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background-color: #1C1C1E; /* iOS Modal Background */
    width: 100%;
    border-radius: 30px 30px 0 0;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

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

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    width: 30px;
    height: 30px;
    border-radius: 15px;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: none;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
    transition: opacity 0.2s;
}

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

.btn:active {
    opacity: 0.8;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(18, 18, 20, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 0.5px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 34px; /* Учет iOS home indicator */
    z-index: 50;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.nav-icon {
    font-size: 24px;
    filter: grayscale(1);
    opacity: 0.5;
    transition: all 0.2s ease;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item.active .nav-icon {
    filter: grayscale(0);
    opacity: 1;
    transform: translateY(-2px);
}

/* Placeholders */
.placeholder-content {
    text-align: center;
    padding-top: 60px;
    color: var(--text-secondary);
}

.placeholder-content h2 {
    color: var(--text-primary);
    margin-bottom: 12px;
}

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

/* Chat UI */
#chat-view {
    height: 100%;
    padding: 0;
}

#chat-view.active-view {
    display: flex;
    flex-direction: column;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-bottom: 20px;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.ai-message {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.user-message {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    align-items: center;
}

#chat-input {
    flex-grow: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-main);
    outline: none;
}

.chat-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    border: none;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.chat-action-btn:active {
    transform: scale(0.9);
}

#mic-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

#mic-btn.recording {
    background: #FF3B30;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 59, 48, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

.hidden {
    display: none !important;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-main);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.4s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.login-card h2 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group input {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.input-group input:focus {
    border-color: var(--accent);
}

.login-error {
    color: var(--color-custom);
    font-size: 13px;
    margin-top: 16px;
    min-height: 16px;
}
