/*
  © 2025 Qagnum. All Rights Reserved.
  Original Stopwatch Web Application developed by Qagnum (https://qagnum.com)

  This source code and design are protected under international copyright laws.
  Unauthorized reproduction, modification, or distribution of this code, in whole or in part,
  is strictly prohibited.

  Contact: qagnum2025@gmail.com
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    visibility: hidden;
}
body.loaded {
    visibility: visible;
}

.stopwatch-display {
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ad-placeholder {
    background: linear-gradient(45deg, #f1f5f9, #e2e8f0);
    border: 2px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-weight: 500;
}

.btn-start {
    background: linear-gradient(135deg, #10b981, #059669);
}

.btn-stop {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-reset {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.btn-lap {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.btn-start:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-stop:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.btn-reset:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.btn-lap:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
}

.dark .glass-effect {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.dark .ad-placeholder {
    background: linear-gradient(45deg, #1e293b, #334155);
    border-color: #475569;
    color: #94a3b8;
}

.dark body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

/* .stopwatch-display {
    font-size: clamp(1.5rem, 8vw, 4rem);
    line-height: 1.1;
}*/

@media (max-width: 400px) {
    .stopwatch-display {
        font-size: 40px !important;
    }

    /* Ultra-mobile footer layout */
    .footer-ultra-mobile {
        display: flex !important;
    }

    .footer-desktop,
    .footer-mobile {
        display: none !important;
    }
}

@media (min-width: 1000px) {
    .stopwatch-display {
        font-size: 80px !important;
    }
}


/* Mobile styles for devices with width less than 400px */
@media (max-width: 399px) {
    #aboutModal .max-w-none {
        font-size: 0.875rem; /* 14px - smaller base text */
        line-height: 1.4;
    }
    
    #aboutModal h3 {
        font-size: 1.25rem !important; /* 20px instead of 24px */
    }
    
    #aboutModal p, #aboutModal li {
        font-size: 0.8rem; /* 12.8px - even smaller for paragraphs */
    }
    
    /* Optional: Reduce padding on very small screens */
    #aboutModal .glass-effect {
        padding: 1rem; /* Reduce from p-6 sm:p-8 */
    }
}



/* Presets styles */
.presets-section {
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    /* No transition for dark mode - instant change to match rest of site */
}

.dark .presets-section {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.presets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.presets-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
    /* No transition for dark mode color changes */
}

.dark .presets-title {
    color: #f1f5f9;
}

.add-preset-btn {
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.add-preset-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.preset-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    /* Only transition transform for hover effects, not color changes for dark mode */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.preset-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: #cbd5e1;
}

.dark .preset-card {
    background: #334155;
    border-color: #475569;
}

.dark .preset-card:hover {
    background: #3f4a5f;
    border-color: #64748b;
}

.preset-name {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    /* No transition for dark mode color changes */
}

.dark .preset-name {
    color: #f1f5f9;
}

.preset-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.preset-detail {
    font-size: 13px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    /* No transition for dark mode color changes */
}

.dark .preset-detail {
    color: #94a3b8;
}

.preset-time {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}

.preset-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.preset-action-btn {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    /* Only transition background-color and transform for hover, not dark mode changes */
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.preset-action-btn.load {
    color: #22c55e;
    border-color: #22c55e;
}

.preset-action-btn.load:hover {
    background: #22c55e;
    color: white;
}

.preset-action-btn.delete {
    color: #ef4444;
    border-color: #ef4444;
}

.preset-action-btn.delete:hover {
    background: #ef4444;
    color: white;
}

.dark .preset-action-btn {
    border-color: #475569;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
    /* No transition for dark mode color changes */
}

.dark .empty-state {
    color: #94a3b8;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .presets-section {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .presets-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }

    .presets-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}


/* Settings modal styles (namespaced) */
.settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    padding: 20px;
}

.settings-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.settings-modal {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    position: relative;
}

.settings-modal-overlay.active .settings-modal {
    transform: scale(1) translateY(0);
}

.dark .settings-modal {
    background: #1e1e2e;
    color: white;
}

.modal-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.dark .modal-header {
    border-bottom-color: #333;
}

.modal-header-content {
    text-align: center;
    flex: 1;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.dark .modal-title {
    color: white;
}

.modal-subtitle {
    color: #666;
    font-size: 14px;
}

.dark .modal-subtitle {
    color: #aaa;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: absolute;
    top: 20px;
    right: 20px;
}

.modal-close-btn:hover {
    background: #f0f0f0;
    color: #333;
    transform: scale(1.1);
}

.dark .modal-close-btn {
    color: #aaa;
}

.dark .modal-close-btn:hover {
    background: #333;
    color: white;
}

.modal-content {
    padding: 32px;
}

.form-section {
    margin-bottom: 32px;
}

.form-section:last-child {
    margin-bottom: 0;
}

.section-label {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark .section-label {
    color: white;
}

.time-inputs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.time-input {
    width: 80px;
    height: 60px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    background: #f8f9fa;
    transition: all 0.3s ease;
    outline: none;
}

.time-input:focus {
    border-color: #00C853;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.1);
}

.dark .time-input {
    background: #2a2a3a;
    border-color: #444;
    color: white;
}

.dark .time-input:focus {
    background: #333;
    border-color: #00C853;
}

.time-separator {
    font-size: 24px;
    font-weight: 700;
    color: #666;
    /* margin: 0 4px; */
    margin: 0px 4px 25px 4px;
}

.dark .time-separator {
    color: #aaa;
}

.time-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.dark .time-label {
    color: #aaa;
}

.count-type-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.count-type-btn {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.count-type-btn.active {
    background: #00C853;
    border-color: #00C853;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 200, 83, 0.3);
}

.dark .count-type-btn {
    background: #2a2a3a;
    border-color: #444;
    color: #aaa;
}

.dark .count-type-btn.active {
    background: #00C853;
    border-color: #00C853;
    color: white;
}

.helper-text {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.dark .helper-text {
    color: #aaa;
}

.sound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.sound-card, .preset-sound-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.sound-card:hover, .preset-sound-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.sound-card.selected, .preset-sound-card.selected {
    border-color: #00C853;
    background: rgba(0, 200, 83, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.1);
}

.dark .sound-card, .dark .preset-sound-card {
    background: #2a2a3a;
    border-color: #444;
}

.dark .sound-card.selected, .dark .preset-sound-card.selected {
    border-color: #00C853;
    background: rgba(0, 200, 83, 0.1);
}

.sound-emoji {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.sound-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.dark .sound-name {
    color: white;
}

.preview-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-btn:hover {
    background: #e0e0e0;
}

.dark .preview-btn {
    background: #444;
    color: white;
}

.dark .preview-btn:hover {
    background: #555;
}

/* added while removing multiple sounds for preview button*/
button.preview-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed;
    /* pointer-events: none; */
}

/* .preview-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none;
} */

/* .preview-btn.playing {
    background-color: #22c55e !important;
    color: white !important;
} */

/* .preview-btn:hover:not(:disabled) {
    transform: translateY(-1px);
} */

.action-buttons {
    display: flex;
    gap: 16px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
}

.dark .action-buttons {
    border-top-color: #333;
}

.btn {
    flex: 1;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: #00C853;
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 200, 83, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 200, 83, 0.4);
}

.btn-secondary {
    background: transparent;
    color: #666;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #d0d0d0;
}

.dark .btn-secondary {
    color: #aaa;
    border-color: #444;
}

.dark .btn-secondary:hover {
    background: #2a2a3a;
    border-color: #555;
}

@media (max-width: 640px) {
    .modal-content {
        padding: 24px;
    }

    .time-inputs {
        gap: 8px;
    }

    .time-input {
        width: 70px;
        height: 50px;
        font-size: 18px;
    }

    .action-buttons {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    .time-input {
        width: 60px;
        height: 50px;
        font-size: 16px;
    }
}



/* preset */
.preset-name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    background: white;
    color: #1e293b;
    transition: all 0.2s ease;
}

.preset-name-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .preset-name-input {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

.dark .preset-name-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Edit button for preset cards */
.preset-action-btn.edit {
    color: #3b82f6;
    border-color: #3b82f6;
}

.preset-action-btn.edit:hover {
    background: #3b82f6;
    color: white;
}


/* CSS for mobile devices rendering of preset */
/* Mobile icons - hidden by default */
.preset-mobile-icons {
    display: none;
    margin-left: 8px;
    font-size: 16px;
}

/* Desktop details - visible by default */
.preset-detail-desktop {
    display: flex;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    /* Hide desktop details on mobile */
    .preset-detail-desktop {
        display: none !important;
    }
    
    /* Show mobile icons */
    .preset-mobile-icons {
        display: inline-block;
    }
    
    /* Increase font size by 2px on mobile */
    .preset-name {
        font-size: 20px; /* Original 18px + 2px */
    }
    
    .preset-time {
        font-size: 15px; /* Increase time display too */
    }
    
    /* Adjust preset details container */
    .preset-details {
        gap: 4px; /* Reduce gap since we have fewer items */
    }
    
    /* Make preset cards more compact */
    .preset-card {
        padding: 16px; /* Reduce from 20px */
    }
}

/* Even smaller screens */
@media (max-width: 480px) {
    .preset-name {
        font-size: 18px;
    }
    
    .preset-time {
        font-size: 14px;
    }
    
    .preset-mobile-icons {
        font-size: 14px;
        margin-left: 6px;
    }
    
    .preset-card {
        padding: 14px;
    }
}
