/* Pages CSS - Specific Styles for Views */

/* Week Grid */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-md);
    padding-bottom: var(--space-xl);
    /* Bottom clearance */
}

/* Week Grid Task Blocks (New) */
.task-block {
    padding: 4px 6px;
    font-size: 0.7rem;
    line-height: 1.2;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    border: 1px solid transparent;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.task-block.task-work {
    background-color: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
    border-left: 3px solid #6366f1;
}

.task-block.task-private {
    background-color: #f9fafb;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.task-block.task-sport {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-left: 3px solid #10b981;
}

.task-block.task-break {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px dashed #fcd34d;
}

.task-block.task-meeting {
    background-color: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    border-left: 3px solid #f97316;
}

.day-column {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 600px;
}

.day-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    text-align: center;
    background-color: #fafbfc;
}

.day-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-date {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-main);
}

.day-content {
    padding: var(--space-sm);
    flex: 1;
    position: relative;
    /* Context for nested absolute blocks */
}

/* Day Plan - Timeline */
.timeline-container {
    position: relative;
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    height: 1440px;
    /* 24h * 60px/h */
    margin-top: var(--space-md);
}

.timeline-hour {
    position: absolute;
    left: 0;
    width: 100%;
    height: 60px;
    /* 1 hour height */
    border-bottom: 1px dashed var(--border-light);
    display: flex;
    align-items: flex-start;
}

.hour-label {
    width: 60px;
    text-align: right;
    padding-right: var(--space-md);
    color: var(--text-secondary);
    font-size: 0.75rem;
    transform: translateY(-50%);
    background: var(--bg-surface);
}

/* Timeline Blocks */
.timeline-block {
    position: absolute;
    /* Default to absolute for timeline */
    left: 70px;
    right: 10px;
    background-color: #e0e7ff;
    border: 1px solid #c7d2fe;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 6px;
    font-size: 0.85rem;
    overflow: hidden;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 10;
}

/* In Week Grid, reset these to generic block style */
.week-grid .timeline-block {
    position: relative;
    left: auto;
    right: auto;
    top: auto !important;
    height: auto !important;
    margin-bottom: 4px;
}

.timeline-block:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.02);
    z-index: 20;
}

.timeline-block.work {
    background-color: #eef2ff;
    border-color: #c7d2fe;
    border-left-color: #6366f1;
}

.timeline-block.sport {
    background-color: #ecfdf5;
    border-color: #a7f3d0;
    border-left-color: #10b981;
}

.timeline-block.meeting {
    background-color: #fff7ed;
    border-color: #fed7aa;
    border-left-color: #f97316;
}

/* Day View - List/Block Mode */
.task-list-view {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.task-item {
    display: flex;
    align-items: center;
    background: #fff;
    padding: var(--space-md);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    gap: var(--space-md);
}

.task-time {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
}

.task-info {
    flex: 1;
}

.task-title {
    font-weight: 600;
    color: var(--text-main);
}

.task-group {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

/* Dictation/Chat Interface */
.chat-container {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 70vh;
}

.chat-messages {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
    background-color: #fafbfc;
}

.message {
    margin-bottom: var(--space-md);
    max-width: 80%;
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    line-height: 1.5;
}

.message.user {
    margin-left: auto;
    background-color: var(--primary);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.message.ai {
    margin-right: auto;
    background-color: #f3f4f6;
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    padding: var(--space-md);
    border-top: 1px solid var(--border-light);
    background: #fff;
    display: flex;
    gap: var(--space-md);
}

/* Date Navigation */
.date-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: #fff;
    padding: 4px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.date-picker-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.date-picker-trigger:hover {
    background-color: #f3f4f6;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    backdrop-filter: blur(2px);
    padding: var(--space-md);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

/* AI Floating Sidebar */

/* AI FAB (Restored) */
.ai-fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    border: none;
    z-index: 60;
    transition: transform 0.2s, background-color 0.2s;
}

.ai-fab:hover {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-hover);
}

/* AI Sidebar (Sliding Panel) */
.ai-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 50;
    /* Below FAB (60) */
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--border-light);
}

.ai-sidebar.active {
    transform: translateX(0);
}

.ai-sidebar-content {
    padding: 32px;
    padding-top: 100px;
    /* Space for FAB if overlapping or top styling */
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ai-sidebar-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Mobile Media Queries */
@media (max-width: 1024px) {
    .week-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns tablet */
    }
}

@media (max-width: 768px) {
    .week-grid {
        grid-template-columns: 1fr;
        /* 1 column mobile */
    }

    .day-column {
        min-height: auto;
        /* Allow auto height */
    }

    .ai-sidebar {
        width: 100%;
        /* Full screen sidebar on mobile */
        top: 0;
        z-index: 300;
    }

    .date-nav .date-picker-trigger {
        font-size: 0.8rem;
    }
}