/* layout.css */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
    overflow-y: hidden; /* Verhindert unnötiges Scrollen */
}

#app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    overflow: hidden; /* Verhindert unnötiges Scrollen */
}

/* Header und Navigationsbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background-color: var(--nav-bg-color, #f8f9fa);
    border-bottom: 1px solid var(--border-color, #dee2e6);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--brand-color, #333);
}

.navbar-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.navbar a {
    text-decoration: none;
    color: var(--nav-link-color, #333);
    font-weight: 500;
    transition: color 0.2s;
}

.navbar a:hover, .dropdown-button:hover {
    color: var(--accent-color, #007bff);
}

/* Hauptcontainer */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

/* Timer und Fortschrittsbalken */
#timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 30px auto 20px;
    width: 100%;
    max-width: 100%;
}

#timer {
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: var(--progress-bg, #e9ecef);
    border-radius: 0.25rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent-color, #007bff);
    transition: width 0.2s ease;
    width: 0%;
}

/* Words Container */
#words-container {
    width: 90%;
    max-width: 1200px;
    margin: 60px auto 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    overflow: visible !important;
    box-sizing: border-box;
    padding: 0;
}

/* Stats Container */
#stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.stat-box {
    text-align: center;
    padding: 0.5rem 1rem;
    min-width: 120px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--sub-color, #6c757d);
}

/* Dropdown-Styling */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--nav-link-color, #333);
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s;
}

.dropdown-content {
    display: none;
    position: absolute;
    min-width: 160px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1000;
    right: 0;
    background-color: var(--dropdown-bg, white);
    border-radius: 0.25rem;
    border: 1px solid var(--border-color, #dee2e6);
    overflow: hidden;
}

.dropdown-content a, .dropdown-content button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-color, #333);
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.dropdown-content a:hover, .dropdown-content button:hover {
    background-color: var(--dropdown-hover-bg, #f8f9fa);
}

.dropdown.show .dropdown-content {
    display: block;
}

/* Mode Dropdown spezifisches Styling */
.mode-dropdown {
    display: inline-block;
    position: relative;
}

#mode-btn {
    display: inline-block;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    background-color: inherit;
    color: inherit;
    border: none;
    border-radius: 0.25rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

#mode-btn:hover {
    color: var(--accent-color, #007bff);
}

.mode-dropdown-content {
    display: none;
    position: absolute;
    min-width: 160px;
    z-index: 1000;
    top: 100%;
    left: 0;
    background-color: var(--dropdown-bg, white);
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color, #dee2e6);
    overflow: hidden;
}

.mode-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-color, #333);
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.mode-option:hover {
    background-color: var(--dropdown-hover-bg, #f8f9fa);
}

.mode-dropdown-content.show {
    display: block;
}

/* Responsives Design */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 0.5rem;
    }
    
    .navbar-menu {
        margin-top: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #timer {
        font-size: 2rem;
    }
    
    .stat-box {
        min-width: 100px;
    }
}

/* General Styles */
header {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 15px 20px;
    transition: opacity 0.3s ease;
    position: relative;
}

header.typing {
    opacity: 0;
    pointer-events: none;
}

header.typing .logo {
    opacity: 0.9;
    pointer-events: auto;
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.6em;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    transition: opacity 0.5s ease, color 0.3s ease;
    z-index: 1000;
}

header.typing .logo:hover {
    opacity: 1;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.35);
}

.logo {
    font-size: 1.8em;
    font-weight: bold;
    position: absolute;
    left: 20px;
    z-index: 10;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 5px;
}

/* Responsivität für die Navbar */
@media (max-width: 1200px) {
    nav {
        padding-left: 120px;
        padding-right: 20px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.2em;
        top: 8px;
    }
    
    nav {
        gap: 5px;
    }
    
    .mode-btn, 
    #theme-toggle, 
    #stats-btn, 
    #back-btn, 
    #focus-toggle, 
    .mode-setting, 
    .end-stats-buttons button {
        padding: 5px 8px;
        font-size: 0.85em;
    }
    
    #words {
        font-size: 1.2em;
        line-height: 1.8em;
    }
    
    #time-select,
    #words-select,
    #language-select {
        font-size: 0.85em;
        padding: 5px;
    }
    
    footer {
        font-size: 0.8em;
        padding: 8px;
    }
    
    .end-stats-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 200px;
        margin: 1rem auto 0;
    }
    
    .end-stats-buttons button {
        width: 100%;
        min-width: 0;
    }
    
    #end-stats {
        width: 95%;
        padding: 1rem;
    }
    
    .stat-item {
        min-width: 80px;
        padding: 0.5rem;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    #words-container {
        width: 98%;
        margin-top: 5px;
        min-height: 100px;
        padding: 10px 0;
    }
    
    #words {
        font-size: 1.2em;
        line-height: 1.5;
        min-height: 100px;
    }
    
    #words-container .main-timer {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    
    .test-active #words-container .main-timer {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
}

.user {
    font-size: 1em;
}

#progress-bar-container {
    width: 95%;
    max-width: 1200px;
    height: 8px;
    border-radius: 4px;
    margin: 5px auto 15px;
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

#progress-bar {
    width: 0%;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease, background-color 0.3s;
    position: relative;
    z-index: 2;
}

/* Meilenstein-Animation */
@keyframes meilenstein-pulse {
    0% { background-color: var(--accent-color); }
    50% { background-color: #ffffff; }
    100% { background-color: var(--accent-color); }
}

#progress-bar.milestone-reached {
    animation: meilenstein-pulse 1s ease;
}

#progress-bar.almost-complete {
    background-color: #4caf50 !important;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
}

/* Meilenstein-Markierungen */
#progress-bar-container::before,
#progress-bar-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.3);
    z-index: 1;
}

#progress-bar-container::before {
    left: 50%;
}

#progress-bar-container::after {
    left: 75%;
}

#progress-bar-container .milestone-25 {
    position: absolute;
    left: 25%;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.3);
    z-index: 1;
}

#words {
    width: 100%;
    display: block;
    min-height: 180px;
    line-height: 1.8;
    position: relative;
    font-size: 1.7rem;
    padding: 0;
    overflow-x: visible !important;
    overflow-y: visible;
    text-align: left;
    box-sizing: border-box;
    max-width: 100%;
    margin: 0 auto;
}

#words-container .main-timer {
    position: relative;
    left: auto;
    transform: none;
    top: auto;
    font-size: 2.5rem;
    font-family: 'Roboto Mono', monospace;
    margin-bottom: 30px;
    text-align: center;
    display: block;
    min-height: 1.5rem;
    position: relative;
    z-index: 1;
    width: 100%;
    opacity: 0.7;
    transition: all 0.3s ease;
    padding: 0;
}

.test-active #words-container .main-timer {
    font-size: 2.8rem;
    opacity: 0.9;
}

/* Verstecke unnötige Timer-Anzeigen */
#progress-bar-container .timer,
.timer-container .timer {
    display: none;
}

/* Timer-Container Styling */
.timer-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 36px;
}

/* Timer einheitlich positionieren */
.main-timer {
    position: relative;
    left: auto;
    transform: none;
    top: auto;
    font-size: 2.5rem;
    font-family: 'Roboto Mono', monospace;
    margin-bottom: 20px;
    text-align: center;
    display: block;
    min-height: 1.5rem;
    position: relative;
    z-index: 1;
    width: 100%;
    opacity: 0.7;
    transition: all 0.3s ease;
    padding: 0;
}

header.typing ~ main #words-container {
    transform: translateY(0);
}

.line {
    white-space: nowrap !important;
    overflow: hidden;
    display: block;
    width: 100%;
    margin-bottom: 0.2em;
    line-height: 1.3;
}

.word {
    margin: 0;
    display: inline;
    position: relative;
}

.letter {
    display: inline;
    letter-spacing: 0.05em;
}

#input {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0.01;
    padding: 0;
    margin: 0;
    border: none;
    outline: none;
    pointer-events: none;
    z-index: -1;
}

#stats,
#end-stats {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9em;
}

/* Die End-Stats werden jetzt als Modal angezeigt und benötigen andere Stile */
#end-stats {
    display: none; /* Standardmäßig ausgeblendet, wird durch JavaScript aktiviert */
}

.end-stats-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap; /* Flexibles Umbrechen für mobile Ansicht */
}

#stats-container {
    width: 80%;
    max-width: 1000px;
    padding: 20px;
    border-radius: 10px;
    margin: 20px auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.filter-section {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-section label {
    margin-right: 10px;
    font-weight: 500;
}

.filter-section select {
    padding: 5px;
    border: none;
    border-radius: 5px;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    transition: background-color 0.3s ease;
}

.chart-container {
    margin-bottom: 40px;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.chart-container:hover {
    transform: translateY(-3px);
}

.summary-stats {
    margin-top: 20px;
    font-size: 1.1em;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.summary-stats p {
    margin: 5px 0;
}

.letter-stats {
    margin-top: 40px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.letter-stats h2 {
    font-size: 1.3em;
    margin-bottom: 20px;
}

#letter-stats-content {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.letter-stat {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 5px;
    transition: transform 0.2s ease, background-color 0.3s ease;
    cursor: pointer;
}

.letter-stat:hover {
    transform: scale(1.1);
}

.letter-stat .tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    white-space: nowrap;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    min-width: 150px;
    text-align: center;
    line-height: 1.5;
    white-space: normal;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.letter-stat:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

footer {
    padding: 10px 20px;
    font-size: 0.9em;
    text-align: center;
    transition: opacity 0.5s ease;
}

footer.typing {
    opacity: 0;
    pointer-events: none;
}

footer a {
    text-decoration: none;
    transition: color 0.3s ease;
}

.refresh-container {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    margin: 0;
    z-index: 100 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: transform 0.3s ease, opacity 0.2s ease;
    opacity: 0.6;
    background-color: rgba(255, 255, 255, 0.1);
}

#refresh-btn:hover {
    transform: rotate(180deg);
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
}

#refresh-btn svg {
    width: 20px;
    height: 20px;
}

/* Styling für auth.html */
#auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    gap: 30px;
}

@media (min-width: 768px) {
    #auth-container {
        flex-direction: row;
        align-items: stretch;
    }
}

.auth-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-form:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.auth-form h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    text-align: center;
}

.auth-form input {
    padding: 12px 15px;
    border: none;
    border-radius: 5px;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 1em;
    width: 100%;
    transition: box-shadow 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.auth-form button {
    padding: 12px 25px;
    margin-top: 10px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-family: 'Roboto Mono', 'Courier New', monospace;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.3s ease, color 0.3s ease;
    width: 100%;
}

.auth-form button:hover {
    transform: scale(1.02);
}

.auth-form button:active {
    transform: scale(0.98);
}

@media (max-width: 600px) {
    #words-container {
        width: 90%;
    }
    .mode-btn,
    #theme-toggle,
    #stats-btn,
    #back-btn,
    #focus-toggle,
    .mode-setting,
    .end-stats-buttons button {
        padding: 5px 10px;
        font-size: 0.9em;
    }
    .timer {
        font-size: 1.1em;
    }
    #words {
        font-size: 1.5em;
        line-height: 2.2em;
    }
    #stats,
    #end-stats,
    #stats-container {
        max-width: 90%;
    }
    .letter-stat {
        width: 35px;
        height: 35px;
        line-height: 35px;
        font-size: 1em;
    }
    .auth-form {
        max-width: 90%;
    }
}

/* Responsive Anpassungen für kleinere Bildschirme */
@media (max-width: 900px) {
    nav {
        justify-content: center;
    }
    
    .nav-group {
        margin: 2px 0;
    }
}

/* Kompaktere Buttons */
nav button {
    padding: 6px 12px !important;
    font-size: 0.9em;
}

nav select {
    padding: 5px 8px !important;
    font-size: 0.9em;
}

/* Visueller Trenner zwischen Gruppen für größere Bildschirme */
@media (min-width: 900px) {
    .nav-group.options-controls {
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0 15px;
        margin: 0 5px;
    }
}