/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Prevent text selection and touch callouts */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    /* Prevent tap highlight */
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ffffff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    /* PWA safe area support */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* PWA specific styles */
@media (display-mode: standalone) {
    body {
        /* Additional styling when running as standalone PWA */
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    }
    
    .app-header {
        /* Account for device notches/status bar in PWA mode */
        padding-top: max(20px, env(safe-area-inset-top));
    }
}

/* App Layout */
#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
}

/* Header Styles */
.app-header {
    padding: 10px 20px 10px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 2px;
    margin: 0;
}

.cache-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.2;
}

.cache-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.cache-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.cache-btn svg {
    animation: none;
    transition: transform 0.3s ease;
}

.cache-btn.refreshing svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.destination-section {
    display: none;
    gap: 10px;
    align-items: center;
}

.destination-input {
    display: none;
    flex: 1;
    padding: 16px 20px; /* Increased padding for better touch targets */
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 18px; /* Larger font for better readability */
    outline: none;
    transition: all 0.3s ease;
    min-height: 52px; /* Minimum touch target height */
}

.destination-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* .destination-input:focus {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
} */

.time-input {
    font-family: inherit;
    padding: 5px 15px;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: #3b73ff;
    font-size: 18px;
    outline: none;
    min-width: 140px;
    min-height: 52px;
    transition: all 0.3s ease;
    filter: invert(100%);
}

.time-input:focus {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 15px;
    min-height: 400px;
}

#radial-clock {
    border-radius: 50%;
    box-shadow: 
        0 0 60px rgba(0, 0, 0, 0.6),
        inset 0 0 40px rgba(255, 255, 255, 0.15);
    background: radial-gradient(circle, #2a2a2a 0%, #1a1a1a 100%);
    cursor: grab;
    touch-action: none;
    max-width: 90vw;
    max-height: 90vw;
    width: 400px;
    height: 400px;
}

#radial-clock:active {
    cursor: grabbing;
}

/* Instructions Overlay */
.instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
    padding: 20px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease;
}

.instructions.hidden {
    opacity: 0;
}

.instructions p {
    margin: 5px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* Start Time Display */
.start-time-display {
    display: flex;
    text-align: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    align-items: center;
    justify-content: flex-start;
}

.start-time-display .label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-right: 10px;
}

.time-value {
    font-size: 24px;
    font-weight: 300;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

/* Task Information Section - Now only contains task list */
.task-info {
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    max-height: 200px;
    overflow: hidden;
}

.task-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-direction: row;
}

.task-list h3 {
    font-size: 16px;
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

#task-list {
    list-style: none;
    max-height: 120px;
    min-height: 120px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 10px; 
    margin: 8px; /* Increased margin for easier selection */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px; /* Slightly larger border radius */
    border-left: 6px solid; /* Thicker accent border */
    transition: all 0.3s ease;
    min-height: 48px; /* Minimum touch target size */
    cursor: pointer;
}

.task-item:hover, .task-item:active {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.02);
}

.task-name {
    font-size: 16px; /* Increased font size for better readability */
    flex: 1;
    font-weight: 500;
}

.task-duration {
    font-size: 14px; /* Increased font size */
    color: rgba(255, 255, 255, 0.8);
    margin-left: 15px;
    font-weight: 500;
}

.clear-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 59, 59, 0.2);
    color: #ff3b3b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 36px;
    white-space: nowrap;
}

.clear-btn:hover {
    background: rgba(255, 59, 59, 0.3);
    transform: translateY(-2px);
}

.clear-btn:active {
    transform: scale(0.98);
}

/* Remove task button styles */
.remove-task {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 24px; /* Larger X button */
    cursor: pointer;
    padding: 8px 12px; /* Larger touch area */
    margin-left: 8px;
    transition: all 0.3s ease;
    min-width: 40px; /* Minimum touch target width */
    min-height: 40px; /* Minimum touch target height */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-task:hover, .remove-task:active {
    color: #ff3b3b;
    background: rgba(255, 59, 59, 0.1);
    transform: scale(1.1);
}

/* Enhanced task highlighting */
.task-item.highlighted {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05) !important;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

/* Task Colors */
.task-color-0 { border-left-color: #ff6b6b; }
.task-color-1 { border-left-color: #4ecdc4; }
.task-color-2 { border-left-color: #45b7d1; }
.task-color-3 { border-left-color: #96ceb4; }
.task-color-4 { border-left-color: #feca57; }
.task-color-5 { border-left-color: #ff9ff3; }
.task-color-6 { border-left-color: #54a0ff; }
.task-color-7 { border-left-color: #5f27cd; }

/* PWA Install Banner */
.install-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    color: #000000;
    z-index: 1000;
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-out;
}

.install-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 500px;
    margin: 0 auto;
    font-size: 14px;
    font-weight: 500;
}

.install-btn {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.2);
    color: #000000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.install-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.dismiss-btn {
    background: none;
    border: none;
    color: #000000;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dismiss-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Adjust app layout when banner is shown */
.install-banner ~ #app {
    margin-top: 60px;
}

@media (max-width: 480px) {
    .app-header {
        padding: 5px 15px 10px;
    }
    
    .header-top {
    }
    
    .app-header h1 {
        font-size: 24px;
        margin-bottom: 0;
    }
    
    .cache-btn {
        width: 40px;
        height: 40px;
    }
    
    .cache-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .destination-section {
        flex-direction: column;
        gap: 8px;
    }
    
    .time-input {
        width: 100%;
        min-width: auto;
    }
    
    .canvas-container {
        padding: 10px;
        min-height: 320px;
    }
    
    #radial-clock {
        width: min(350px, 85vw);
        height: min(350px, 85vw);
        max-width: 85vw;
        max-height: 85vw;
    }
    
    .task-info {
        padding: 15px;
    }
    
    .start-time-display {
        padding: 0px 15px
    }
    
    .task-list-header {
        gap: 8px;
    }
    
    .clear-btn {
        font-size: 12px;
        padding: 6px 12px;
        min-height: 32px;
    }
    
    .install-content {
        font-size: 13px;
    }
    
    .install-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-height: 600px) {
    .task-info {
        max-height: 150px;
    }
    
    #task-list {
        max-height: 70px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
