/* gantt.css - Styles for the Gantt chart view */

.gantt-controls {
    display: flex;
    gap: 0.5em;
    align-items: center;
    margin-bottom: 1.5em;
    flex-wrap: wrap;
}

.gantt-btn {
    padding: 0.5em 0.75em;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
    white-space: nowrap;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
}

.gantt-btn:hover {
    background: #2980b9;
}

/* Navigation buttons (Back, Reset, Forward) - Blue */
.gantt-btn-nav {
    background: #3498db;
}

.gantt-btn-nav:hover {
    background: #2980b9;
}

/* Action buttons (Zoom, Categories) - Purple */
.gantt-btn-action {
    background: #9b59b6;
}

.gantt-btn-action:hover {
    background: #8e44ad;
}

.gantt-date-range {
    font-weight: 600;
    color: #555;
    margin-left: auto;
}

.gantt-chart-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.gantt-chart {
    width: 100%;
    display: table;
    table-layout: fixed;
}

.gantt-header {
    display: table-row;
    font-weight: 600;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gantt-header > div {
    display: table-cell;
    padding: 0.75em;
    border: 1px solid #ddd;
    text-align: center;
    vertical-align: middle;
}

.gantt-row {
    display: table-row;
}

.gantt-row:hover {
    background: #f8f9fa;
}

.gantt-category-label {
    display: table-cell;
    padding: 0.5em;
    border: 1px solid #ddd;
    font-weight: 600;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gantt-category-tappable {
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.gantt-category-tappable:active {
    opacity: 0.7;
}

.gantt-day-header {
    font-size: 0.85em;
    line-height: 1.4;
}

.gantt-day-cell {
    display: table-cell;
    border: 1px solid #ddd;
    min-height: 30px;
    height: 30px;
    position: relative;
    padding: 0;
    vertical-align: middle;
}

.gantt-entry-bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 0.5em;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.gantt-entry-bar:hover {
    opacity: 0.8;
    transform: translateY(-50%) scale(1.05);
    z-index: 10;
}

.gantt-entry-open {
    border-right: 3px solid #e74c3c;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        border-right-color: #e74c3c;
    }
    50% {
        border-right-color: #c0392b;
    }
}

.gantt-entry-title {
    color: white;
    font-size: 0.75em;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Open entries section */
.open-entries-section {
    margin-top: 3em;
    padding-top: 2em;
    border-top: 2px solid #ddd;
}

.open-entries-header {
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 1em;
    color: #333;
}

.open-entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5em;
}

@media (max-width: 768px) {
    .open-entries-grid {
        grid-template-columns: 1fr;
    }
    
    .gantt-controls {
        gap: 0.4em;
    }
    
    .gantt-btn {
        flex: 0 0 auto;
    }
    
    .gantt-date-range {
        width: 100%;
        flex-basis: 100%;
        text-align: center;
        margin-left: 0;
        margin-top: 0.5em;
        order: 10;
    }
    
    .gantt-category-label {
        min-width: 100px;
        font-size: 0.85em;
    }
    
    .gantt-day-cell {
        min-width: 60px;
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
}

/* Entry cards (for open entries) */
.entry-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.entry-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.entry-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1em;
}

.entry-card-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.entry-card-category {
    display: inline-block;
    padding: 0.25em 0.75em;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    color: white;
    margin-bottom: 0.75em;
}

.entry-card-time {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 0.5em;
}

.entry-card-duration {
    font-size: 0.85em;
    color: #999;
    font-style: italic;
}

.entry-card-description {
    color: #555;
    line-height: 1.6;
    margin: 1em 0;
}

.entry-card-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin: 1em 0;
}

.entry-ref-tag {
    background: #f0f0f0;
    padding: 0.25em 0.75em;
    border-radius: 12px;
    font-size: 0.75em;
    color: #555;
}

.entry-card-actions {
    display: flex;
    gap: 0.5em;
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #eee;
}

.entry-card-actions .btn {
    flex: 1;
    padding: 0.5em;
    text-align: center;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

/* Category Management Modal */
.category-list {
    margin-bottom: 2em;
}

.category-list h3 {
    margin-bottom: 1em;
    color: #333;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1em;
}

.category-item {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 1em;
    display: flex;
    align-items: center;
    gap: 1em;
    transition: transform 0.2s, box-shadow 0.2s;
}

.category-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-color-badge {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.category-item-info {
    flex: 1;
}

.category-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25em;
}

.category-item-color {
    font-size: 0.75em;
    color: #666;
    font-family: monospace;
}

.category-item-actions {
    display: flex;
    gap: 0.5em;
}

.category-item-actions button {
    padding: 0.25em 0.5em;
    font-size: 0.75em;
}

.category-form {
    border-top: 2px solid #ddd;
    padding-top: 2em;
}

.category-form h3 {
    margin-bottom: 1em;
    color: #333;
}

.color-picker-group {
    display: flex;
    gap: 0.5em;
    align-items: center;
}

.color-picker-group input[type="color"] {
    width: 60px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.color-picker-group input[type="text"] {
    flex: 1;
}

/* iOS Safari landscape optimization for single-day view */
@media (max-width: 926px) and (orientation: landscape) {
    /* When in single-day view on mobile landscape, minimize category column */
    body.journal-single-day-view .gantt-category-label {
        min-width: 60px;
        max-width: 60px;
        width: 60px;
        font-size: 0.75em;
        padding: 0.3em;
        writing-mode: vertical-rl;
        text-orientation: mixed;
    }
    
    /* Ensure day cells take advantage of the extra space */
    body.journal-single-day-view .gantt-day-cell {
        min-width: auto;
    }
}
