/* ==================== ROUTINE STYLES ==================== */

.routine-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.routine-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#routine-day-select {
    flex: 1;
    max-width: 200px;
    padding: 0.6rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

#routine-day-select:hover {
    border-color: var(--color-accent);
    background: rgba(0, 0, 0, 0.4);
}

#routine-day-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent)22;
}

.routine-timeline {
    position: relative;
    min-height: 600px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 3rem 1rem 2rem;
    overflow-x: auto;
    overflow-y: visible;
    cursor: context-menu;
}

.routine-timeline-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.routine-hour-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--color-text);
    opacity: 0.5;
    padding: 0.5rem 0.3rem;
    white-space: nowrap;
}

.routine-hour-marker::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
}

.routine-current-time {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-accent);
    box-shadow: 0 0 10px var(--color-accent), 0 0 20px var(--color-accent)44;
    z-index: 10;
    pointer-events: none;
    animation: pulse-line 2s ease-in-out infinite;
}

@keyframes pulse-line {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 10px var(--color-accent), 0 0 20px var(--color-accent)44;
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 15px var(--color-accent), 0 0 30px var(--color-accent)66;
    }
}

.routine-current-time::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-accent);
}

.routine-entries-container {
    position: relative;
    min-height: 500px;
    padding-top: 1rem;
}

/* Compact square entry cards */
.routine-entry {
    position: absolute;
    min-width: 140px;
    min-height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    z-index: 1;
    cursor: pointer;
}

/* Fixed width for non-progress entries */
.routine-entry-text,
.routine-entry-checkbox,
.routine-entry-checklist {
    width: 140px;
}

/* Progress bars can span wider */
.routine-entry-progress {
    width: auto;
    min-height: 120px;
    height: auto;
}

.routine-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 8px var(--color-accent)22;
    border-color: var(--color-accent)44;
    z-index: 2;
}

/* Progression indicators */
.routine-entry-behind {
    border-left: 3px solid #ff6666;
    background: rgba(255, 102, 102, 0.05);
}

.routine-entry-ontrack {
    border-left: 3px solid #66ff66;
    background: rgba(102, 255, 102, 0.05);
}

.routine-entry-time {
    font-size: 0.7rem;
    color: var(--color-accent);
    font-weight: 600;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.routine-entry-content {
    color: var(--color-text);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.routine-entry-checkbox {
    min-height: 60px;
}

.routine-entry-checkbox .routine-entry-content {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.routine-entry-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--color-accent);
    flex-shrink: 0;
}

.routine-entry-checkbox label {
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
}

/* Checklist styles */
.routine-checklist-header {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--color-accent);
    font-size: 0.75rem;
}

.routine-checklist-items {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.routine-checklist-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
}

.routine-checklist-item input[type="checkbox"] {
    width: 12px;
    height: 12px;
    cursor: pointer;
    accent-color: var(--color-accent);
    flex-shrink: 0;
}

.routine-checklist-item label {
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
}

/* Progress bar styles */
.routine-progress-label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--color-accent);
    font-size: 0.75rem;
}

.routine-progress-bar {
    position: relative;
    height: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: visible;
    margin-bottom: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.routine-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-buttons));
    box-shadow: 0 0 8px var(--color-accent)44;
    transition: width 0.3s ease;
    border-radius: 8px;
}

.routine-progress-expected {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #ffaa00;
    box-shadow: 0 0 4px #ffaa00;
    z-index: 1;
}

.routine-progress-current {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
}

.routine-progress-input {
    width: 45px;
    padding: 0.2rem 0.3rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--color-text);
    font-size: 0.75rem;
    text-align: center;
}

.routine-progress-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent)22;
}

/* Context menu */
.routine-context-menu {
    position: absolute;
    background: rgba(26, 31, 28, 0.98);
    border: 1px solid var(--color-accent);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 12px var(--color-accent)44;
    z-index: 1000;
    min-width: 150px;
    overflow: hidden;
}

.routine-context-menu-item {
    padding: 0.7rem 1rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.routine-context-menu-item:hover {
    background: var(--color-accent);
    color: var(--color-background);
}

.routine-context-menu-item i {
    width: 16px;
    text-align: center;
}

/* Stagger entries vertically to avoid overlap */
.routine-entry:nth-child(odd) {
    top: 0;
}

.routine-entry:nth-child(even) {
    top: 120px;
}

.routine-entry:nth-child(3n) {
    top: 240px;
}

.routine-entry:nth-child(4n) {
    top: 360px;
}

/* Modal segment and checklist fields */
.routine-segment-field,
.routine-checklist-field {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.routine-segment-field input[type="time"],
.routine-segment-field input[type="number"],
.routine-checklist-field input[type="text"] {
    flex: 1;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--color-text);
    font-size: 0.9rem;
}

.routine-segment-field input:focus,
.routine-checklist-field input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent)22;
}

.routine-segment-field button,
.routine-checklist-field button {
    padding: 0.5rem 0.7rem;
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 4px;
    color: #ff6666;
    cursor: pointer;
    transition: all 0.2s;
}

.routine-segment-field button:hover,
.routine-checklist-field button:hover {
    background: rgba(255, 0, 0, 0.3);
    border-color: rgba(255, 0, 0, 0.5);
}

#routine-progress-segments-container,
#routine-checklist-items-container {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}

.modal-btn-secondary {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
}