/**
 * Professional Exam Timer Solutions CSS
 * CalcTechLab.com
 * Modern, responsive, and accessible design
 */

/* ========================================
   1. RESET & BASE STYLES
   ======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   2. HEADER SECTION
   ======================================== */

.timer-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    animation: fadeInDown 0.6s ease;
}

.timer-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.timer-header .subtitle {
    font-size: 1.3rem;
    opacity: 0.95;
    font-weight: 300;
}

.timer-header .icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: inline-block;
    animation: pulse 2s ease infinite;
}

/* ========================================
   3. CONTROL PANEL
   ======================================== */

.control-panel {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.8s ease;
}

.control-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.control-panel-title {
    font-size: 1.5rem;
    color: #1e40af;
    font-weight: 600;
}

.timer-count-badge {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
}

.control-panel-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.global-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

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

.global-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.add-timer-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.start-all-btn {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

.pause-all-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.reset-all-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.clear-all-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.settings-group {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-item label {
    font-weight: 600;
    color: #475569;
}

.setting-item select {
    padding: 8px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.setting-item select:focus {
    outline: none;
    border-color: #2563eb;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.4s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #2563eb;
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.fullscreen-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.fullscreen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ========================================
   4. TIMERS CONTAINER
   ======================================== */

.timers-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

/* ========================================
   5. TIMER CARD
   ======================================== */

.timer-card {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.6s ease;
    transition: all 0.3s ease;
    position: relative;
}

.timer-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.timer-card.completed {
    animation: flashGreen 0.5s ease 3;
}

.timer-card.completed::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(148, 163, 184, 0.4);
    border-radius: 20px;
    pointer-events: none;
    z-index: 1;
}

.timer-card.completed > * {
    position: relative;
    z-index: 2;
}

/* Timer Header inside Timer Card */
.timer-card .timer-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

/* Timer Title Input */
.timer-title-input {
    flex: 1 !important;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e40af;
    background: white !important;
    transition: all 0.3s ease;
    display: block !important;
    outline: none;
}

.timer-title-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.timer-title-input:hover {
    border-color: #cbd5e1;
}

/* Delete Timer Button */
.delete-timer-btn {
    padding: 10px 16px !important;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: white !important;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
    flex-shrink: 0;
    min-width: 100px;
    white-space: nowrap;
}

.delete-timer-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.delete-timer-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

.delete-timer-btn .icon {
    font-size: 18px;
    line-height: 1;
}

/* ========================================
   6. TIMER DETAILS
   ======================================== */

.timer-details {
    margin-bottom: 20px;
}

.detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.timer-date-input,
.timer-center-input {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.timer-date-input:focus,
.timer-center-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.timer-description-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

.timer-description-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========================================
   7. TIME INPUT SECTION
   ======================================== */

.time-input-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 15px;
}

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

.time-input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.digit-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.digit-btn {
    width: 60px;
    height: 30px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

.digit-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

.digit-btn:active {
    transform: scale(0.95);
}

.time-value {
    width: 60px;
    height: 50px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e40af;
    border: 3px solid #2563eb;
    border-radius: 10px;
    background: white;
    transition: all 0.3s ease;
}

.time-value:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.time-separator {
    font-size: 2rem;
    font-weight: 700;
    color: #2563eb;
    margin: 0 5px;
}

/* ========================================
   8. TIMER VISUAL
   ======================================== */

.timer-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    min-height: 200px;
}

/* Clock Visual */
.clock-visual {
    width: 200px;
    height: 200px;
}

.clock-hand {
    transform-origin: 100px 100px;
    transition: transform 0.3s ease;
}

/* Ring Visual */
.ring-visual {
    width: 200px;
    height: 200px;
}

.ring-progress {
    transition: stroke-dashoffset 0.3s ease;
}

.ring-percentage {
    font-weight: 700;
}

/* Bar Visual */
.bar-visual {
    width: 100%;
    max-width: 300px;
}

.bar-background {
    width: 100%;
    height: 30px;
    background: #e2e8f0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.bar-progress {
    height: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
    transition: width 0.3s ease;
    border-radius: 15px;
}

.bar-percentage {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e40af;
}

/* ========================================
   9. TIMER DISPLAY
   ======================================== */

.timer-display {
    text-align: center;
    margin-bottom: 20px;
}

.time-text {
    font-size: 3rem;
    font-weight: 700;
    color: #1e40af;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

.progress-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #64748b;
}

/* ========================================
   10. TIMER CONTROLS
   ======================================== */

.timer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

.pause-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.reset-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.clear-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* ========================================
   11. NOTIFICATIONS
   ======================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.notification-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.notification-info {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
}

/* ========================================
   12. SEO CONTENT SECTION
   ======================================== */

.seo-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeIn 1s ease;
}

.seo-content h2 {
    color: #1e40af;
    font-size: 2rem;
    margin-bottom: 20px;
}

.seo-content h3 {
    color: #2563eb;
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
}

.seo-content p {
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 15px;
}

.seo-content ul,
.seo-content ol {
    margin-left: 30px;
    margin-bottom: 20px;
}

.seo-content li {
    color: #475569;
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 10px;
}

.faq-section {
    margin-top: 40px;
}

.faq-item {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 10px;
    border-left: 4px solid #2563eb;
}

.faq-question {
    font-weight: 700;
    color: #1e40af;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.faq-answer {
    color: #475569;
    line-height: 1.7;
}

/* ========================================
   13. ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes flashGreen {
    0%, 100% {
        background: white;
    }
    50% {
        background: #d1fae5;
    }
}

/* ========================================
   14. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .timers-container {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .timer-header h1 {
        font-size: 2rem;
    }
    
    .timer-header .subtitle {
        font-size: 1rem;
    }
    
    .control-panel {
        padding: 20px;
    }
    
    .control-panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timers-container {
        grid-template-columns: 1fr;
    }
    
    .time-input-section {
        gap: 10px;
        padding: 15px;
    }
    
    .time-value {
        width: 50px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .digit-btn {
        width: 50px;
        height: 25px;
    }
    
    .time-text {
        font-size: 2.5rem;
    }
    
    .timer-controls {
        gap: 8px;
    }
    
    .control-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .seo-content {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .timer-header h1 {
        font-size: 1.5rem;
    }
    
    .time-input-section {
        flex-wrap: wrap;
    }
    
    .time-separator {
        display: none;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
    }
    
    .global-controls {
        width: 100%;
    }
    
    .global-btn {
        flex: 1;
        justify-content: center;
    }
}

/* ========================================
   15. EMBED MODE STYLES
   ======================================== */

.embed-mode {
    padding: 0;
    background: white;
}

.embed-mode .timer-header,
.embed-mode .seo-content {
    display: none;
}

.embed-mode .control-panel {
    border-radius: 0;
    box-shadow: none;
    padding: 12px;
    margin-bottom: 16px;
}

.embed-mode .timers-container {
    margin-bottom: 0;
}

.embed-mode .timer-card {
    padding: 16px;
    margin-bottom: 16px;
}

.embed-mode .timer-card .timer-header {
    display: flex !important;
    padding: 0;
    margin-bottom: 12px;
}

.embed-mode .timer-title-input {
    font-size: 16px;
    padding: 8px 12px;
}

.embed-mode .delete-timer-btn {
    padding: 8px 14px !important;
    font-size: 13px;
    min-width: 90px;
}

/* ========================================
   16. PRINT STYLES
   ======================================== */

@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .control-panel,
    .timer-controls,
    .seo-content {
        display: none;
    }
    
    .timer-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
}
