/**
 * Arbeitszeit Helden - Custom Styles
 * Timer & Rechner Tools für den Arbeitsalltag
 */

/* Root Variables */
:root {
    --brand-primary: #1e88e5;
    --brand-secondary: #64748b;
    --brand-accent: #ff6b35;
    --brand-background: #f8fafc;
    --brand-text: #1e293b;
}

/* Base Styles */
body {
    background-color: var(--brand-background);
    color: var(--brand-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header - only apply generic styles if not using glassmorphism header */
header:not(.ah-header) {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
}

header:not(.ah-header) h1 {
    margin-bottom: 0.5rem;
}

/* Main Container */
main {
    padding: 2rem 1rem;
    min-height: 60vh;
}

/* Footer - only apply generic styles if not using glassmorphism footer */
footer:not(.ah-footer) {
    text-align: center;
    padding: 1rem;
    background-color: var(--brand-secondary);
    color: white;
}

footer:not(.ah-footer) a {
    color: white;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tab-navigation button {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--brand-primary);
    background: transparent;
    color: var(--brand-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    border-radius: 4px;
}

.tab-navigation button:hover:not(:disabled) {
    background: rgba(30, 136, 229, 0.1);
}

.tab-navigation button[aria-selected="true"] {
    background: var(--brand-primary);
    color: white;
}

.tab-navigation button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Timer Panel */
.timer-panel {
    text-align: center;
}

.timer-panel[hidden] {
    display: none;
}

/* Timer Phase Label */
.timer-phase {
    font-size: 1.2rem;
    color: var(--brand-secondary);
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Timer Display */
.timer-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 5rem;
    font-weight: bold;
    text-align: center;
    margin: 2rem 0;
    color: var(--brand-text);
    letter-spacing: 0.1em;
}

/* Timer Controls */
.timer-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.timer-controls button {
    min-width: 100px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.timer-controls .btn-primary {
    background: var(--brand-primary);
    color: white;
}

.timer-controls .btn-primary:hover:not(:disabled) {
    background: #1565c0;
}

.timer-controls .btn-secondary {
    background: var(--brand-secondary);
    color: white;
}

.timer-controls .btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.timer-controls .btn-settings {
    background: transparent;
    border: 2px solid var(--brand-secondary);
    color: var(--brand-secondary);
}

.timer-controls .btn-settings:hover:not(:disabled) {
    background: var(--brand-secondary);
    color: white;
}

/* Session Count */
.session-count {
    font-size: 0.9rem;
    color: var(--brand-secondary);
    margin-top: 1rem;
}

/* Lap List */
.lap-list {
    margin-top: 2rem;
    max-height: 250px;
    overflow-y: auto;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}

.lap-list:empty {
    display: none;
}

.lap-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    font-family: 'Courier New', Courier, monospace;
}

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

.lap-number {
    font-weight: bold;
    color: var(--brand-primary);
    min-width: 40px;
}

.lap-times {
    display: flex;
    gap: 1.5rem;
}

.lap-time {
    color: var(--brand-text);
}

.total-time {
    color: var(--brand-secondary);
}

/* Settings Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--brand-text);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-buttons button {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.modal-buttons .btn-primary {
    background: var(--brand-primary);
    color: white;
}

.modal-buttons .btn-secondary {
    background: var(--brand-secondary);
    color: white;
}

/* Coming Soon Text */
.coming-soon {
    color: var(--brand-secondary);
    font-style: italic;
    margin-top: 2rem;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .timer-display {
        font-size: 3.5rem;
    }

    .tab-navigation button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .timer-controls button {
        min-width: 80px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Section Separator */
.section-separator {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 3rem 0 2rem 0;
}

.section-title {
    text-align: center;
    color: var(--brand-secondary);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Calculator Panel */
.calculator-panel {
    max-width: 500px;
    margin: 0 auto;
    padding: 1.5rem;
}

.calculator-panel[hidden] {
    display: none;
}

.calculator-input-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Input Groups */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 500;
    color: var(--brand-text);
}

.input-group input,
.input-group select {
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--brand-primary);
    outline: 2px solid rgba(30, 136, 229, 0.2);
}

/* Time Dropdowns */
.time-dropdowns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.time-selects {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.time-selects select {
    flex: 1;
    padding: 0.5rem;
}

.time-separator {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--brand-secondary);
}

/* Mode Toggle Button */
.btn-mode-toggle {
    background: transparent;
    border: 2px solid var(--brand-secondary);
    color: var(--brand-secondary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-mode-toggle:hover {
    background: var(--brand-secondary);
    color: white;
}

/* Calculate Button */
.btn-calculate {
    background: var(--brand-accent);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

.btn-calculate:hover {
    background: #e55a2b;
    transform: translateY(-1px);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* Rechenweg Container */
.rechenweg-container {
    margin-top: 1.5rem;
    min-height: 50px;
}

.rechenweg-error {
    color: #dc2626;
    background: #fef2f2;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #fecaca;
}

/* Rechenweg Steps */
.rechenweg {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.rechenweg-step {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.rechenweg-step:last-of-type {
    border-bottom: none;
}

.rechenweg-label {
    color: var(--brand-secondary);
}

.rechenweg-value {
    font-weight: 500;
    color: var(--brand-text);
}

.rechenweg-result {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: var(--brand-primary);
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

.rechenweg-result .rechenweg-label,
.rechenweg-result .rechenweg-value {
    color: white;
}

/* Result Container */
.result-container {
    margin-top: 1.5rem;
    text-align: center;
}

.result-highlight {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, var(--brand-primary), #1565c0);
    color: white;
    padding: 1.5rem 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

.result-value {
    font-size: 2.5rem;
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace;
}

.result-unit {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

/* Countdown Input Group */
.countdown-input-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.countdown-input-group label {
    font-weight: 500;
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
}

/* Calculator responsive */
@media (max-width: 600px) {
    .time-dropdowns {
        grid-template-columns: 1fr;
    }

    .result-value {
        font-size: 2rem;
    }

    .result-highlight {
        padding: 1rem 2rem;
    }
}

/* Date Input Styling */
input[type="date"] {
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

input[type="date"]:focus {
    border-color: var(--brand-primary);
    outline: 2px solid rgba(30, 136, 229, 0.2);
}

/* KW Result - larger display */
.kw-result .result-value {
    font-size: 3rem;
    letter-spacing: 0.05em;
}

.kw-result .result-unit {
    font-size: 1.2rem;
    font-weight: 500;
}

/* Result Details */
.result-details {
    color: var(--brand-secondary);
    margin-top: 1rem;
    font-size: 0.95rem;
}

/* Date input responsive */
@media (max-width: 600px) {
    .kw-result .result-value {
        font-size: 2.5rem;
    }
}

/* Settings Panel Styles */
.settings-section-title {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--pico-muted-border-color, #e2e8f0);
    color: var(--brand-text);
}

.settings-section-title:first-child {
    margin-top: 0;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.setting-item label {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
    font-weight: 500;
    color: var(--brand-text);
}

.setting-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.setting-item input[type="number"] {
    width: 100px;
}

.setting-item input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.setting-item small {
    display: block;
    width: 100%;
    color: var(--brand-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Settings responsive adjustments */
@media (max-width: 480px) {
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .setting-item label {
        min-width: auto;
    }

    .setting-item input[type="number"],
    .setting-item input[type="range"] {
        width: 100%;
        max-width: none;
    }
}

/* History Panel Styles */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-header h3 {
    margin: 0;
}

.history-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-nav button {
    padding: 0.25rem 0.75rem;
    min-width: auto;
}

#history-month-display {
    font-weight: 600;
    min-width: 140px;
    text-align: center;
}

.history-calendar {
    margin-bottom: 1.5rem;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--brand-secondary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--brand-background);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
    position: relative;
    border: 1px solid #e2e8f0;
}

.calendar-day:hover {
    background: var(--brand-primary);
    color: white;
}

.calendar-day.other-month {
    color: var(--brand-secondary);
    opacity: 0.5;
}

.calendar-day.today {
    border: 2px solid var(--brand-primary);
}

.calendar-day.selected {
    background: var(--brand-primary);
    color: white;
}

.calendar-day .activity-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.calendar-day .activity-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--brand-primary);
}

.calendar-day .activity-dot.break {
    background: var(--brand-secondary);
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--brand-background);
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--brand-secondary);
}

.history-day-detail {
    background: var(--brand-background);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
}

.history-day-detail h4 {
    margin: 0 0 0.75rem 0;
}

.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.history-list li:last-child {
    border-bottom: none;
}

.history-list .session-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-list .session-type {
    font-size: 0.75rem;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: var(--brand-primary);
    color: white;
}

.history-list .session-type.break {
    background: var(--brand-secondary);
}

.history-list .session-actions button {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    min-width: auto;
}

.history-trash {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.history-trash ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
}

.history-trash li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #fef2f2;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

@media (max-width: 480px) {
    .history-stats {
        grid-template-columns: 1fr;
    }

    .calendar-day {
        font-size: 0.8rem;
    }
}

/* E-E-A-T Authority Sources */
.ah-authority-sources {
    margin-top: 40px;
    padding: 30px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(30, 136, 229, 0.15);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
}
.ah-authority-sources h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0 0 8px 0;
}
.ah-authority-intro {
    line-height: 1.7;
    color: #cbd5e1;
    margin-bottom: 20px;
}
.ah-authority-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.ah-authority-links li {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: rgba(30, 136, 229, 0.08);
    border: 1px solid rgba(30, 136, 229, 0.2);
    border-radius: 12px;
    transition: all 0.2s ease;
}
.ah-authority-links li:hover {
    background: rgba(30, 136, 229, 0.15);
    border-color: rgba(30, 136, 229, 0.4);
    transform: translateY(-1px);
}
.ah-authority-links a {
    color: #e2e8f0;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ah-authority-links a:hover {
    color: #1e88e5;
}
.ah-authority-links a::before {
    content: "↗";
    color: #1e88e5;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.ah-authority-source {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 4px;
    padding-left: 22px;
}

@media (min-width: 600px) {
    .ah-authority-links {
        grid-template-columns: repeat(2, 1fr);
    }
}
