* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
}

.timer-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* SVG Elements */
svg {
    position: absolute;
    top: 0;
    left: 0;
}

 /* wrapper to encompass both indicators and display */
 .display-wrapper {
    position: absolute;
    top: 1rem;
    left: 0.75rem;  /* Same as indicator position */
    display: flex;
    align-items: flex-start;
    gap: .75rem;  /* Space between indicators and display */
    cursor: pointer;  /* Show pointer cursor for entire area */
    padding: 4px;  /* Optional: adds a bit of invisible padding for easier clicking */
  }

/* Timer Display */
.timer-display, .numeric-display {
    position: relative;
    top: 0;
    left: 0; 
    cursor: pointer;
  }

.numeric-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
}

.timer-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #1a1a1a;
    transition: transform 0.2s ease;
}

.timer-button:hover {
    background-color: #f0f0f0;
}

.timer-button.active {
    transform: scale(0.95);
}

/* Display options indicator */
.display-indicator {
    position: relative;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 60px;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.3s ease;
  }
  
  .display-indicator span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background-color: white;
    opacity: 0.3;
    transition: opacity 0.3s ease;
  }
  
  .display-indicator span.active {
    opacity: 1;
  }
  
  .display-hint {
    position: absolute;
    top: 1rem;
    left: 6.5rem;  /* Adjusted for new display position */
    color: white;
    font-size: 0.875rem;
    opacity: 0;
    transform: translateY(20px) translateX(-20px);  /* Start slightly left and down */
    transition: 
      opacity 0.6s ease-out,
      transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);  /* Smooth easing */
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 4px;
    white-space: nowrap;
  }

  .display-hint::before {
    content: '';
    position: absolute;
    left: -8px;  /* Pull it left outside the hint box */
    top: 50%;    /* Center vertically */
    transform: translateY(-50%);  /* Perfect vertical centering */
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid rgba(0, 0, 0, 0.4); /* Same color as hint background */
}
  
  .display-hint.show {
    opacity: 0.9;
    transform: translateY(20px) translateX(0);  /* Slide in from left */
  }

/* Pause Button */
.pause-button {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

/* Add mobile-specific adjustments */
@media screen and (max-width: 768px) {  /* or whatever breakpoint you prefer */
    .pause-button {
        position: fixed; /* Change to fixed */
        bottom: calc(env(safe-area-inset-bottom, 1rem) + 1rem);
        right: 1rem;
        z-index: 1000;
        /* padding: 0.75rem 1rem; Slightly bigger touch target */
    }
}

/* Timer Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    transform-origin: calc(100% - 1rem) 1rem; /* Align with timer button's position */
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    width: 90%;
    max-width: 800px;
    display: flex;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    /* transform: translateY(20px);
    transition: transform 0.3s ease; */
    transform: scale(0.5);
    opacity: 0;
    transform-origin: calc(100% - 2rem) 2rem; /* Slightly offset from button */
    transition: 
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-info {
    flex: 0.4;
    padding: 2rem;
    background: linear-gradient(135deg, #e6f2ff 0%, #f5f9ff 100%);
    display: flex;
    flex-direction: column;
}

.modal-info h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;  /* Space between logo and text */
    font-size: 1.8rem;
    color: #1a1a1a;
    margin-bottom: 1.5rem;
}


.modal-logo {
    width: 32px;  /* Adjust size as needed */
    height: 32px;
}

.modal-info h2 {
    font-size: 1.8rem;
    color: #1a1a1a;
    margin-bottom: 1rem;
}

.modal-info p {
    font-size: 1rem;
    color: #666;
    line-height: 1.5;
}

.modal-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    font-size: 0.875rem;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-footer a {
    color: #3b82f6;
    text-decoration: none;
}

.modal-footer a:hover {
    text-decoration: underline;
}

.modal-controls {
    flex: 0.6;
    padding: 2rem;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 0.75rem 0;  /* Explicitly set all margins */
}

.modal-header h2 {
    margin: 0;  /* Remove any default margins from the h2 */
    padding: 0;  /* Remove any default padding */
    font-size: 1rem;  /* Match the size if needed */
    line-height: 1;   /* Ensure consistent line height */
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    padding: 0.5rem;
    transition: background-color 0.2s ease;
}

.close-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.modal-controls .time-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: .5rem;
}

.modal-controls .input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.input-group label {
    font-size: 0.875rem;
    color: #666;
}

.input-group input {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 1rem;
}

.sound-option {
    margin-bottom: .5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-label + .checkbox-label {
    margin-top: 10px;  /* Adds space only between checkboxes, not above the first one */
}

/* Theme selector */
.theme-group {
    margin-bottom: 1.5rem;
}

.theme-group label {
    font-size: 0.875rem;
    color: #666;
    display: block;
    margin-bottom: 0.25rem;
}

.theme-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

.theme-group select:hover {
    border-color: #b3b3b3;
}

.theme-group select:focus {
    outline: none;
    border-color: #666;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-buttons button {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f0f0f0;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.modal-buttons button:hover {
    background-color: #e0e0e0;
}

.modal-status {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    text-align: center;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
}
.modal-status.active {
    opacity: 1;
    height: auto;
    padding: 1rem;
    margin-top: 1.5rem;
}

.modal-time-display {
    font-size: 2.5rem;
    font-weight: bold;
    font-family: monospace;
    color: #1a1a1a;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.modal-state-label {
    font-size: 0.875rem;
    color: #666;
}

/* Style disabled start button */
.modal-buttons button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e0e0e0;
}

/* Only apply hover effect to non-disabled buttons */
.modal-buttons button:not(.disabled):hover {
    background-color: #e0e0e0;
}

.modal-buttons .primary:not(.disabled):hover {
    opacity: 0.9;
    background: linear-gradient(135deg, #4F46E5 0%, #3B82F6 100%);
}

.primary {
    background: linear-gradient(135deg, #4F46E5 0%, #3B82F6 100%);
    color: white;
    transition: opacity 0.2s ease;
}

.primary:hover {
    opacity: 0.9;
}

.keyboard-shortcuts {
    margin-top: 6rem;
    font-size: 0.875rem;
}

/* Remove padding when modal-status is active */
.modal-status.active + .keyboard-shortcuts {
    margin-top: 1.5rem;
}

.keyboard-shortcuts h2 {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

kbd {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    font-size: 0.75rem;
    min-width: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.shortcut span {
    color: #666;
}

button svg {
    position: relative;
    vertical-align: middle;
}

.hidden {
    display: none !important;
}

@media screen and (max-width: 768px) and (min-width: 480px) {
    /* Optimize modal padding for tablet */
    .modal-info, .modal-controls {
        padding: 1.5rem;
    }

    /* Make input fields share space better */
    .time-inputs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        max-width: 400px;  /* Prevent inputs from stretching too wide */
    }

    /* Theme dropdown shouldn't stretch full width */
    .theme-group select {
        max-width: 400px;
    }
    
    /* Status display can be smaller on tablet */
    .modal-time-display {
        font-size: 2rem;
    }

    /* Keep checkbox options at a reasonable width */
    .sound-option {
        max-width: 400px;
    }
}

.input-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
}

.input-group input:invalid {
    border-color: #ef4444;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
        max-height: 90vh;
        width: 450px;
        max-width: 95%; /* Slightly wider */
        margin: 1rem auto;
        overflow-y: auto;
        transform: none; /* Remove transform animation on mobile */
    }

    .modal-info {
        padding: 1.1rem 1.75rem;
        min-height: auto; /* Allow it to shrink */
    }

    .modal-controls {
        padding: 1.75rem;
    }

     /* Ensure inputs are easily tappable */
     .input-group input,
     .theme-group select,
     .modal-buttons button {
         min-height: 44px; /* iOS minimum tappable size */
     }

     .keyboard-shortcuts {
        display: none;
    }

     /* Ensure modal appears above everything */
    .modal {
        z-index: 9999;
    }
}
