/* ============================================================================
   CSS VARIABLES
   ============================================================================ */

:root {
    --primary-color: #8b0000;
    --secondary-color: #a52a2a;
    --accent-color: #800000;
    --primary-light: #b40024;
    --primary-dark: #660000;
    --text-color: #2c3e50;
    --text-light: #6b7280;
    --light-bg: #f8f9fa;
    --border-color: #e5e7eb;
    --border-radius: 16px;
    --card-shadow: 0 4px 20px rgba(139, 0, 0, 0.12);
    --card-hover-shadow: 0 8px 30px rgba(139, 0, 0, 0.18);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-hover: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    --success-color: #059669;
    --success-light: #10b981;
}

/* ============================================================================
   TIMER WIDGET STYLES
   ============================================================================ */

.timer-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    background: #8b0000;
    border-radius: 50%;
    box-shadow: 0 8px 24px rgba(139, 0, 0, 0.25), 0 4px 12px rgba(139, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.95);
    z-index: 1000;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    transition: var(--transition);
    will-change: transform;
    cursor: pointer;
}

.timer-widget.expanded {
    width: 380px;
    height: auto;
    border-radius: var(--border-radius);
    min-height: 220px;
    background: #8b0000;
    box-shadow: 0 12px 48px rgba(139, 0, 0, 0.2), 0 4px 16px rgba(139, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.timer-widget.dragging {
    transition: none;
    box-shadow: 0 16px 56px rgba(139, 0, 0, 0.35), 0 8px 24px rgba(139, 0, 0, 0.2);
    transform: scale(1.05);
}

.timer-widget:hover {
    box-shadow: 0 12px 32px rgba(139, 0, 0, 0.3), 0 6px 16px rgba(139, 0, 0, 0.2);
    transform: translateY(-3px);
    background: #a52a2a;
}

.timer-widget-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    z-index: 2;
    transition: var(--transition);
}

.timer-widget-icon i {
    font-size: 26px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.timer-widget-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ffffff;
    color: #8b0000;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 3px solid #8b0000;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.12);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 3px 8px rgba(0, 0, 0, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    }
}

.timer-widget-header {
    background: #8b0000;
    color: white;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.timer-widget-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    pointer-events: none;
}

.timer-widget-title {
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.3px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-widget-title i {
    font-size: 18px;
    opacity: 0.95;
}

.timer-widget-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.timer-widget-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1) rotate(90deg);
}

.timer-widget-content {
    max-height: 360px;
    overflow-y: auto;
    padding: 0;
    background: #8b0000;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.timer-widget-loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    padding: 48px 24px;
    font-size: 14px;
    line-height: 1.6;
}

.timer-widget-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    padding: 48px 24px;
    font-size: 14px;
    line-height: 1.6;
    gap: 16px;
    position: relative;
    min-height: 120px;
}

.timer-widget-empty::before {
    content: '\f017';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 48px;
    color: rgba(255, 255, 255, 0.2);
    display: block;
}

.timer-widget-item {
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.timer-widget-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: var(--transition);
    transform: scaleY(0);
    transform-origin: top;
}

.timer-widget-item:hover {
    background: rgba(255, 255, 255, 0.08);
    padding-left: 26px;
}

.timer-widget-item:hover::before {
    opacity: 1;
    transform: scaleY(1);
}

.timer-widget-item:last-child {
    border-bottom: none;
}

.timer-widget-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 12px;
}

.timer-widget-issue {
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
    letter-spacing: 0.2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timer-widget-machine {
    font-size: 11px;
    color: #8b0000;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 12px;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    flex-shrink: 0;
}

.timer-widget-time {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    letter-spacing: 0.5px;
    position: relative;
    display: inline-block;
    padding-left: 24px;
}

.timer-widget-time::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    opacity: 1;
}

.timer-widget-footer {
    padding: 18px 22px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    background: #8b0000;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.timer-widget-new {
    width: 100%;
    padding: 13px 20px;
    background: #ffffff;
    color: #8b0000;
    border: 2px solid #ffffff;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.timer-widget-new::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139, 0, 0, 0.1), transparent);
    transition: left 0.5s ease;
}

.timer-widget-new:hover {
    background: #f5f5f5;
    border-color: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    color: #8b0000;
}

.timer-widget-new:hover::before {
    left: 100%;
}

.timer-widget-new:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

.timer-widget-content::-webkit-scrollbar {
    width: 6px;
}

.timer-widget-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.timer-widget-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
}

.timer-widget-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .timer-widget.expanded {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        bottom: 20px;
        max-width: 400px;
    }
}

@media (max-width: 576px) {
    .timer-widget.expanded {
        width: calc(100vw - 32px);
        right: 16px;
        left: 16px;
        bottom: 16px;
    }
    
    .timer-widget-header {
        padding: 14px 16px;
    }
    
    .timer-widget-title {
        font-size: 14px;
    }
    
    .timer-widget-item {
        padding: 14px 16px;
    }
    
    .timer-widget-footer {
        padding: 14px 16px;
    }
    
    .timer-widget-new {
        padding: 10px 16px;
        font-size: 13px;
        width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    .timer-widget.expanded {
        width: calc(100vw - 24px);
        right: 12px;
        left: 12px;
        bottom: 12px;
    }
    
    .timer-widget-header {
        padding: 12px 14px;
    }
    
    .timer-widget-title {
        font-size: 13px;
    }
    
    .timer-widget-item {
        padding: 12px 14px;
    }
    
    .timer-widget-footer {
        padding: 12px 14px;
    }
    
    .timer-widget-new {
        padding: 8px 14px;
        font-size: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .timer-widget-issue {
        font-size: 13px;
    }
    
    .timer-widget-time {
        font-size: 18px;
    }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

.timer-widget {
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse animation for active timers - removed to reduce visual noise */

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .timer-widget,
    .timer-widget-item,
    .timer-widget-new,
    .timer-widget-toggle {
        animation: none;
        transition: none;
    }
}

@media (prefers-contrast: high) {
    .timer-widget {
        border: 2px solid var(--primary-color);
    }
    
    .timer-widget-header {
        border-bottom: 2px solid white;
    }
    
    .timer-widget-item {
        border-bottom: 2px solid #e5e7eb;
    }
}

/* ============================================================================
   FOCUS STATES
   ============================================================================ */

.timer-widget-toggle:focus,
.timer-widget-new:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.timer-widget-item:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

/* ============================================================================
   DARK MODE SUPPORT
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .timer-widget {
        background: #8b0000;
        border-color: rgba(255, 255, 255, 0.2);
    }
    
    .timer-widget-header {
        background: #8b0000;
    }
    
    .timer-widget-footer {
        background: #8b0000;
    }
    
    .timer-widget-content {
        background: #8b0000;
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .timer-widget-item {
        background: transparent;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .timer-widget-item:hover {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.05) 100%);
    }
    
    .timer-widget-issue {
        color: #fca5a5;
    }
    
    .timer-widget-machine {
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.1) 100%);
        border-color: rgba(255, 255, 255, 0.2);
        color: #ffffff;
    }
    
    .timer-widget-loading,
    .timer-widget-empty {
        color: #d1d5db;
    }
    
    .timer-widget-empty::before {
        opacity: 0.3;
    }
} 