/* ====================================================
   AGENDA MOBILE - OTIMIZAÇÃO REDMI NOTE 14
   Resolução: ~393x873 viewport
   ==================================================== */

/* Grid compacto para Full HD e mobile */
.week-grid.compact {
    grid-auto-rows: 20px; /* Compacto para Full HD */
}

.day-grid {
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-auto-rows: 25px;
    gap: 1px;
    background-color: var(--agenda-border);
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.day-grid.compact {
    grid-auto-rows: 20px; /* Compacto para Full HD */
}

/* ======================== CHECKLIST CATEGORIES ======================== */
.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--agenda-border);
}

.checklist-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--agenda-text-primary);
}

.btn-archive {
    background-color: var(--agenda-bg-secondary);
    border: 1px solid var(--agenda-border);
    border-radius: 4px;
    color: var(--agenda-text-secondary);
    cursor: pointer;
    transition: var(--agenda-transition);
}

.btn-archive:hover {
    background-color: var(--agenda-bg-tertiary);
    color: var(--agenda-primary);
}

.checklist-category {
    margin-bottom: 16px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--agenda-bg-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    color: var(--agenda-text-primary);
    transition: var(--agenda-transition);
    margin-bottom: 8px;
}

.category-header:hover {
    background-color: var(--agenda-bg-tertiary);
}

.category-icon {
    font-size: 12px;
}

.category-tasks {
    padding-left: 16px;
}

.task-archive {
    opacity: 0;
    transition: var(--agenda-transition);
}

.checklist-item:hover .task-archive {
    opacity: 1;
}

/* ======================== MOBILE OPTIMIZATION (Redmi Note 14) ======================== */
@media (max-width: 430px) and (min-height: 900px) {
    /* Redmi Note 14: ~393x873 viewport */
    
    .agenda-container {
        height: 100vh;
        overflow: hidden;
    }
    
    .agenda-header {
        padding: 8px 12px;
        height: 56px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        background-color: var(--agenda-bg-primary);
        border-bottom: 1px solid var(--agenda-border);
        flex-wrap: wrap;
    }
    
    .header-left h1 {
        font-size: 18px;
        margin: 0;
    }
    
    .header-left #currentTime {
        font-size: 11px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
        margin-top: 8px;
    }
    
    .view-selector {
        gap: 4px;
        flex: 1;
    }
    
    .view-btn {
        padding: 6px 8px;
        font-size: 11px;
        border-radius: 16px;
        flex: 1;
        min-width: 0;
    }
    
    .date-navigation {
        gap: 8px;
    }
    
    .nav-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .btn-primary {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .action-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .agenda-main {
        flex-direction: column;
        padding-top: 80px; /* Header height + controls */
        padding-bottom: 64px; /* bottom bar */
        height: calc(100vh - 80px);
    }
    
    .agenda-sidebar {
        width: 100%;
        max-height: 200px;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid var(--agenda-border);
        overflow-y: auto;
    }
    
    .sidebar-section {
        margin-bottom: 12px;
    }
    
    .section-header h3 {
        font-size: 14px;
    }
    
    .checklist-item {
        padding: 6px 0;
        font-size: 13px;
    }
    
    .checklist-checkbox {
        width: 16px;
        height: 16px;
        min-width: 16px;
    }
    
    .checklist-text {
        font-size: 12px;
    }
    
    .upcoming-event {
        padding: 8px;
        font-size: 12px;
    }
    
    .calendar-container {
        flex: 1;
        height: calc(100vh - 280px - 64px);
        padding: 0;
    }
    
    .calendar-content {
        height: 100%;
        padding: 8px;
    }
    
    /* Ajustes para vistas móveis */
    .week-header-cell {
        padding: 4px 2px;
        font-size: 9px;
    }
    
    .time-slot {
        font-size: 8px;
        padding-right: 4px;
    }
    
    .week-grid.compact,
    .day-grid.compact {
        grid-auto-rows: 16px;
    }
    
    .event-block {
        font-size: 9px;
        padding: 1px 3px;
        border-radius: 2px;
    }
    
    .event-title {
        font-weight: 500;
        line-height: 1.2;
    }
    
    .event-time {
        font-size: 8px;
        opacity: 0.8;
    }
    
    .month-cell {
        min-height: 70px;
        padding: 4px;
    }
    
    .month-cell-header {
        font-size: 12px;
    }
    
    .month-event {
        font-size: 9px;
        padding: 1px 3px;
    }
    
    .year-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
    }
    
    .year-month {
        padding: 12px;
    }
    
    .year-day {
        min-height: 18px;
        font-size: 9px;
    }
    
    /* Modal móvel */
    .modal-content {
        width: 95%;
        max-width: 360px;
        margin: 20px auto;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-control {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .modal-footer button {
        width: 100%;
        padding: 12px;
    }
    
    /* Categorias mobile */
    .category-header {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .category-tasks {
        padding-left: 12px;
    }
    
    .checklist-header h3 {
        font-size: 14px;
    }
    
    .btn-archive {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* LIST VIEW (mobile) */
.list-view { padding-bottom: 80px; }
.list-day { margin-bottom: 16px; }
.list-day-header { 
    padding: 8px 12px; 
    background: var(--agenda-bg-secondary); 
    border-left: 3px solid var(--agenda-primary); 
    font-weight: 600; 
    text-transform: capitalize;
}
.list-item { 
    display: grid; 
    grid-template-columns: 56px 1fr; 
    gap: 8px; padding: 10px 12px; 
    border-bottom: 1px solid var(--agenda-border);
}
.list-item:active { background: var(--agenda-bg-tertiary); }
.list-time { color: var(--agenda-text-tertiary); font-weight: 500; }
.list-title { color: var(--agenda-text-primary); font-weight: 500; }

/* ======================== LANDSCAPE MOBILE ======================== */
@media (max-width: 900px) and (max-height: 430px) {
    /* Landscape mode */
    .agenda-main {
        flex-direction: row;
        padding-top: 56px;
    }
    
    .agenda-sidebar {
        width: 280px;
        max-height: none;
        border-right: 1px solid var(--agenda-border);
        border-bottom: none;
    }
    
    .calendar-container {
        height: calc(100vh - 56px);
    }
}

/* ======================== BOTTOM NAV ======================== */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 64px;
    background: var(--agenda-bg-primary);
    border-top: 1px solid var(--agenda-border);
    display: none;
    grid-template-columns: repeat(5, 1fr);
    z-index: 1000;
}

.bn-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--agenda-text-secondary);
    gap: 4px;
    font-size: 11px;
}

.bn-item i { font-size: 18px; }
.bn-item.active { color: var(--agenda-primary); }

@media (max-width: 430px) {
    .bottom-nav { display: grid; }
}
