* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #F5F5F5;
    padding: 20px;
}

.location-info-bar {
    background-color: white;
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    font-size: 14px;
}

@media (max-width: 768px) {
    .location-info-bar {
        padding: 8px 10px;
        gap: 6px 10px;
        font-size: 11px;
        row-gap: 6px;
    }

    .location-status {
        width: 100%;
        margin-bottom: 2px;
    }

    .prayer-time {
        font-size: 10px;
        white-space: nowrap;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .location-info-bar {
        padding: 6px 8px;
        gap: 4px 8px;
        font-size: 10px;
    }

    .prayer-time {
        font-size: 9px;
    }
}

.location-status {
    color: #666;
}

.location-status.error {
    color: #ff6b6b;
}

.prayer-time {
    color: #4ECDC4;
    font-weight: 600;
}

.container {
    display: flex;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
    height: calc(100vh - 100px);
}

.panel {
    flex: 1;
    background-color: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.panel-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.template-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.template-nav h2 {
    margin: 0;
    min-width: 200px;
    text-align: center;
}

.btn-nav {
    padding: 8px 14px;
    font-size: 20px;
    font-weight: bold;
    min-width: 40px;
    background-color: #f0f0f0;
    color: #333;
}

.btn-nav:hover {
    background-color: #e0e0e0;
}

.btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: #4ECDC4;
    color: white;
}

.btn-primary:hover {
    background-color: #45b8b0;
}

.btn-success {
    background-color: #00B894;
    color: white;
}

.btn-secondary {
    background-color: #ddd;
    color: #333;
}

.form-container {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 10px;
}

.input-field {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.input-field:focus {
    outline: none;
    border-color: #4ECDC4;
}

.form-buttons {
    display: flex;
    gap: 10px;
}

.color-picker-section {
    margin-bottom: 10px;
}

.color-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.color-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.color-option.selected {
    border-color: #333;
    transform: scale(1.15);
}

.color-option.free-time-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #555;
}

.free-time-label {
    color: white;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-input {
    width: 100%;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
}

.color-input:hover {
    border-color: #4ECDC4;
}

.timeline-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.timeline {
    position: relative;
    min-height: 1440px; /* 24 hours * 60px per hour */
}

.hour-marker {
    position: absolute;
    left: 0;
    right: 0;
    height: 60px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: flex-start;
}

.hour-label {
    position: absolute;
    left: 0;
    top: -8px;
    font-size: 12px;
    color: #999;
    font-weight: 500;
    background-color: white;
    padding: 0 5px;
}

.task-block {
    position: absolute;
    left: 60px;
    right: 10px;
    border-radius: 8px;
    padding: 10px;
    cursor: move;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    color: white;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: visible;
}

.task-block:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.task-block.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.task-block.wrapped-task {
    border-top: 3px dashed rgba(255, 255, 255, 0.5);
}

.task-block.completed {
    opacity: 0.5;
    filter: grayscale(30%);
}

.task-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 5;
    accent-color: white;
}

/* Smaller checkbox for very small blocks */
.task-block.task-tiny .task-checkbox {
    width: 12px;
    height: 12px;
    top: 50%;
    transform: translateY(-50%);
    left: 4px;
}

.task-tracking {
    position: absolute;
    top: 6px;
    right: 6px;
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    z-index: 5;
    backdrop-filter: blur(4px);
    max-height: 80px;
    overflow: visible;
}

/* Hide tracking on hover only for small blocks */
.task-block.task-small .task-tracking,
.task-block.task-tiny .task-tracking {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    top: 3px;
    right: 3px;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-block.task-small:hover .task-tracking,
.task-block.task-tiny:hover .task-tracking {
    opacity: 1;
}

/* Hide tracking completely on tiny blocks to save space */
.task-block.task-tiny .task-tracking {
    display: none;
}

.task-block.task-small .task-progress-container {
    display: none;
}

.task-block.task-small .tracking-info {
    font-size: 8px;
    flex-direction: row;
    gap: 4px;
}

.task-block.task-small .tracking-row {
    gap: 2px;
}

.task-block.task-small .tracking-label {
    display: none; /* Hide labels on small blocks */
}

.task-block.task-small .tracking-value {
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Free time tracking */
.free-time-tracking {
    background-color: rgba(0, 0, 0, 0.4) !important;
}

.free-time-badge {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    opacity: 0.9;
}

.task-block.task-small .status-dot {
    width: 8px;
    height: 8px;
}

/* Make task name smaller on small blocks */
.task-block.task-small .task-name {
    font-size: 11px;
    margin-bottom: 1px;
    padding-right: 5px; /* Less padding since tracking is hidden */
}

.task-block.task-small .task-time {
    font-size: 9px;
}

/* When hovering, add padding back for tracking */
.task-block.task-small:hover .task-name {
    padding-right: 80px;
}

/* Very small blocks (less than 25px) - ultra compact */
.task-block.task-tiny {
    padding: 4px 8px;
}

.task-block.task-tiny .task-name {
    font-size: 10px;
    margin-bottom: 0;
    line-height: 1.1;
    padding-right: 30px; /* Room for action buttons */
}

.task-block.task-tiny .task-time {
    display: none; /* Hide duration on very small blocks */
}

/* Adjust padding for very small blocks with checkbox */
.task-block.task-tiny:has(.task-checkbox) .task-name {
    padding-left: 18px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.green {
    background-color: #00B894;
    box-shadow: 0 0 6px rgba(0, 184, 148, 0.6);
}

.status-dot.yellow {
    background-color: #FDCB6E;
    box-shadow: 0 0 6px rgba(253, 203, 110, 0.6);
}

.status-dot.red {
    background-color: #FF6B6B;
    box-shadow: 0 0 6px rgba(255, 107, 107, 0.6);
}

.tracking-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 9px;
    line-height: 1.2;
}

.tracking-row {
    display: flex;
    gap: 4px;
    justify-content: space-between;
    white-space: nowrap;
}

.tracking-label {
    opacity: 0.8;
}

.tracking-value {
    font-weight: 600;
}

.task-progress-container {
    width: 60px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.task-progress-fill {
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.task-name {
    font-weight: 600;
    margin-bottom: 3px;
    padding-right: 20px; /* Space for status dot */
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Add left padding when checkbox is present (schedule entries) */
.task-block:has(.task-checkbox) .task-name {
    padding-left: 28px;
}

.task-block:has(.task-checkbox) .task-time {
    padding-left: 28px;
}

/* Extra padding for small blocks with checkbox */
.task-block.task-small:has(.task-checkbox) .task-name,
.task-block.task-small:has(.task-checkbox) .task-time {
    padding-left: 26px;
}

.task-time {
    font-size: 11px;
    opacity: 0.9;
    line-height: 1.2;
}

.task-time {
    font-size: 12px;
    opacity: 0.9;
}

.task-actions {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 4px;
}

.task-block:hover .task-actions {
    opacity: 1;
}

.action-btn {
    background-color: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.action-btn.color-btn {
    font-size: 14px;
}

/* Smaller action buttons for very small blocks */
.task-block.task-tiny .action-btn {
    width: 18px;
    height: 18px;
    font-size: 10px;
}

.task-block.task-tiny .action-btn.color-btn {
    font-size: 11px;
}

/* Position action buttons properly on tiny blocks */
.task-block.task-tiny .task-actions {
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    right: 3px;
    padding: 2px;
}

/* Color picker popup */
.color-picker-popup {
    position: fixed;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 200px;
}

.color-picker-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.color-picker-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-picker-option:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.color-picker-option.selected {
    border-color: #333;
    transform: scale(1.1);
}

.color-picker-custom {
    width: 100%;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-picker-custom:hover {
    border-color: #4ECDC4;
}

.drop-zone {
    position: absolute;
    left: 60px;
    right: 10px;
    background-color: rgba(78, 205, 196, 0.1);
    border: 2px dashed #4ECDC4;
    border-radius: 8px;
    pointer-events: none;
    transition: all 0.2s;
}

/* Prayer time markers */
.prayer-marker {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    pointer-events: none;
    z-index: 10;
}

.prayer-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
}

.prayer-label {
    position: absolute;
    right: 15px;
    top: -10px;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

/* Sunrise - orange/yellow */
.sunrise-marker .prayer-line {
    background: linear-gradient(to right, rgba(255, 183, 77, 0.3), rgba(255, 183, 77, 0.8), rgba(255, 183, 77, 0.3));
    box-shadow: 0 0 10px rgba(255, 183, 77, 0.5);
}

.sunrise-marker .prayer-label {
    background-color: rgba(255, 183, 77, 0.95);
}

/* Dhuhr - bright yellow/gold */
.dhuhr-marker .prayer-line {
    background: linear-gradient(to right, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.8), rgba(255, 215, 0, 0.3));
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.dhuhr-marker .prayer-label {
    background-color: rgba(255, 215, 0, 0.95);
}

/* Asr - amber/orange */
.asr-marker .prayer-line {
    background: linear-gradient(to right, rgba(255, 152, 0, 0.3), rgba(255, 152, 0, 0.8), rgba(255, 152, 0, 0.3));
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.asr-marker .prayer-label {
    background-color: rgba(255, 152, 0, 0.95);
}

/* Isha - deep blue/purple */
.isha-marker .prayer-line {
    background: linear-gradient(to right, rgba(63, 81, 181, 0.3), rgba(63, 81, 181, 0.8), rgba(63, 81, 181, 0.3));
    box-shadow: 0 0 10px rgba(63, 81, 181, 0.5);
}

.isha-marker .prayer-label {
    background-color: rgba(63, 81, 181, 0.95);
}

/* Scrollbar styling */
.timeline-container::-webkit-scrollbar {
    width: 8px;
}

.timeline-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.timeline-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        height: auto;
    }

    .panel {
        min-height: 600px;
    }

    .template-nav h2 {
        font-size: 18px;
        min-width: 160px;
    }

    .btn-nav {
        padding: 6px 10px;
        font-size: 18px;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .panel-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .template-nav {
        justify-content: center;
    }

    .template-nav h2 {
        font-size: 15px;
        min-width: 140px;
    }
}
