/* Timer Widget Styles - Three State System */
.time-tracker {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 
                0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Dark mode class-based styling */
body.dark-mode .time-tracker {
    background-color: #2a2a3e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 
                0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* State 1: Icon only */
.time-tracker.icon-only {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: pulse-subtle 3s ease-in-out infinite;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.time-tracker.icon-only .time-tracker-toggle {
    background: none;
    padding: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    outline: none;
    position: relative;
}

.time-tracker.icon-only .clock-icon-only {
    font-size: 22px;
    color: white;
    animation: rotate-gentle 4s linear infinite;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
    display: block;
    text-align: center;
    font-family: "Font Awesome 6 Free", FontAwesome;
    font-weight: 900;
    -webkit-font-smoothing: antialiased;
}

.time-tracker.icon-only .toggle-text,
.time-tracker.icon-only .expand-icon {
    display: none;
}

@keyframes rotate-gentle {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* State 2: Expanded (full timer) - removed collapsed state */

/* Log time button integrated into expanded timer controls */

/* State 3: Expanded (full timer) */
.time-tracker.expanded {
    width: 300px;
    /* Height auto for content */
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18),
                0 0 0 1px rgba(0, 0, 0, 0.08);
}

body.dark-mode .time-tracker.expanded {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.1);
}

@keyframes pulse-subtle {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
    50% { 
        transform: scale(1.06);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    }
}

.time-tracker-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    border: none;
    outline: none;
    font-size: 14px;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.clock-icon-only {
    display: none;
}

.toggle-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expand-icon {
    transition: transform 0.3s ease;
}

.time-tracker.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Close button for timer */
.timer-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 12px;
}

.timer-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.time-tracker-content {
    padding: 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: #212529;
}

body.dark-mode .time-tracker-content {
    background: #2a2a3e;
    color: #e9ecef;
}

.time-tracker.icon-only .time-tracker-content {
    max-height: 0;
    padding: 0;
}

.time-tracker.expanded .time-tracker-content {
    max-height: 300px;
}

.timer-display {
    font-size: 2.2em;
    text-align: center;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1a1a2e;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body.dark-mode .timer-display {
    color: #f5f5f5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.timer-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 5px;
    flex-wrap: wrap;
}

.timer-btn {
    flex: 1;
    margin: 0 4px;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.timer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s ease;
}

.timer-btn:hover::before {
    background: rgba(255, 255, 255, 0.1);
}

.timer-btn:first-child {
    margin-left: 0;
}

.timer-btn:last-child {
    margin-right: 0;
}

.timer-btn i {
    margin-right: 5px;
}

.timer-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#timer-start {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

#timer-start:hover:not(:disabled) {
    background: linear-gradient(135deg, #38a169, #2f855a);
    box-shadow: 0 3px 12px rgba(72, 187, 120, 0.4);
    transform: translateY(-1px);
}

#timer-pause {
    background: linear-gradient(135deg, #ed8936, #dd6b20);
    color: white;
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

#timer-pause:hover:not(:disabled) {
    background: linear-gradient(135deg, #dd6b20, #c05621);
    box-shadow: 0 3px 12px rgba(237, 137, 54, 0.4);
    transform: translateY(-1px);
}

#timer-stop {
    background: linear-gradient(135deg, #fc8181, #f56565);
    color: white;
    box-shadow: 0 2px 8px rgba(252, 129, 129, 0.3);
}

#timer-stop:hover:not(:disabled) {
    background: linear-gradient(135deg, #f56565, #e53e3e);
    box-shadow: 0 3px 12px rgba(252, 129, 129, 0.4);
    transform: translateY(-1px);
}

#timer-log {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

#timer-log:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px) scale(1.02);
}

.timer-stats {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: 14px;
    margin-top: 12px;
}

body.dark-mode .timer-stats {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.timer-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    transition: background 0.2s ease;
}

/* Ensure timer values have proper color with higher specificity */
.time-tracker .timer-stat span:not(.stat-label),
.time-tracker .timer-stats .timer-stat span:last-child {
    color: #212529 !important;
    font-weight: 700;
}

body.dark-mode .time-tracker .timer-stat span:not(.stat-label),
body.dark-mode .time-tracker .timer-stats .timer-stat span:last-child {
    color: #e9ecef !important;
}

body.dark-mode .timer-stat {
    background: rgba(255, 255, 255, 0.03);
}

.timer-stat:hover {
    background: rgba(102, 126, 234, 0.08);
}

body.dark-mode .timer-stat:hover {
    background: rgba(102, 126, 234, 0.15);
}

.timer-stat:last-child {
    margin-bottom: 0;
}

/* Stat labels - ensure proper color in both modes */
.time-tracker .stat-label,
.timer-stat .stat-label,
.timer-stats .stat-label,
span.stat-label {
    color: #495057 !important;
    font-weight: 500;
    letter-spacing: 0.2px;
}

body.dark-mode .time-tracker .stat-label,
body.dark-mode .timer-stat .stat-label,
body.dark-mode .timer-stats .stat-label,
body.dark-mode span.stat-label {
    color: #9a9aae !important;
}

/* Timer stat values - explicit selectors with highest specificity */
.stat-value,
.time-tracker #current-session,
.time-tracker #today-total,
.time-tracker #all-time-total,
.time-tracker .timer-stat > span:nth-child(2),
.time-tracker .timer-stats span#current-session,
.time-tracker .timer-stats span#today-total,
.time-tracker .timer-stats span#all-time-total {
    color: #212529 !important;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.95em;
}

body.dark-mode .stat-value,
body.dark-mode .time-tracker #current-session,
body.dark-mode .time-tracker #today-total,
body.dark-mode .time-tracker #all-time-total,
body.dark-mode .time-tracker .timer-stat > span:nth-child(2),
body.dark-mode .time-tracker .timer-stats span#current-session,
body.dark-mode .time-tracker .timer-stats span#today-total,
body.dark-mode .time-tracker .timer-stats span#all-time-total {
    color: #e9ecef !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .time-tracker.icon-only {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    .time-tracker.icon-only .clock-icon-only {
        font-size: 18px;
    }
    
    @keyframes rotate-gentle {
        0% { transform: translate(-50%, -50%) rotate(0deg); }
        100% { transform: translate(-50%, -50%) rotate(360deg); }
    }
    
    .time-tracker.expanded {
        width: 240px;
        bottom: 15px;
        right: 15px;
        border-radius: 10px;
    }
}

/* OVERRIDE: Force timer stat values to be visible in light mode */
body:not(.dark-mode) .time-tracker .timer-stats span[id$="-session"],
body:not(.dark-mode) .time-tracker .timer-stats span[id$="-total"],
body:not(.dark-mode) #current-session,
body:not(.dark-mode) #today-total,
body:not(.dark-mode) #all-time-total {
    color: #1a1a1a !important;
    -webkit-text-fill-color: #1a1a1a !important;
}

/* Ensure dark mode still works */
body.dark-mode #current-session,
body.dark-mode #today-total,
body.dark-mode #all-time-total {
    color: #f0f0f0 !important;
    -webkit-text-fill-color: #f0f0f0 !important;
}
