@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/*/ --- Global Reset & Body Styling --- /*/
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/*/ Custom Scrollbar /*/
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #000000;
}
::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #000000; /*/ Deep Slate Dark Mode -> Pure Black /*/
    color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/*/ --- Navigation --- /*/
nav {
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav h1 {
    font-size: 1.5rem;
    margin: 0;
    color: #ffffff;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-link {
    color: #cccccc;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #ffffff;
}

/*/ --- Master Toggle (Tabs) --- /*/
.master-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem auto;
    background: rgba(20, 20, 20, 0.8);
    padding: 0.5rem;
    border-radius: 9999px; /*/ Pill shape /*/
    border: 1px solid rgba(255,255,255,0.1);
}

.master-toggle button {
    background: transparent;
    color: #888888;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.master-toggle button:hover {
    color: #ffffff;
}

.master-toggle button.active {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
}

/*/ --- Main Container --- /*/
.main {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    padding: 0 20px 20px;
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/*/ --- Educational Card Styling --- /*/
.edu-card {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: fadeUp 0.5s ease-out;
}

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

.edu-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 1.8rem;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.subtitle {
    text-align: center;
    font-size: 15px;
    margin-bottom: 30px;
    color: #888888;
    line-height: 1.5;
}

/*/ --- Textareas --- /*/
.textarea-group {
    margin-bottom: 1.5rem;
}

.textarea-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #cccccc;
    margin-bottom: 8px;
}

textarea {
    width: 100%;
    background: #111111;
    border: 2px solid #333333;
    color: #ffffff;
    padding: 1.2rem;
    border-radius: 16px;
    font-family: 'Inter', monospace;
    font-size: 1.1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
}

textarea[readonly] {
    background: rgba(20, 20, 20, 0.4);
    border-color: #111111;
    color: #888888;
}

/*/ --- Settings Grid (Sliders & Toggles) --- /*/
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    background: #111111;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-group label {
    font-size: 14px;
    font-weight: 600;
    color: #888888;
    display: flex;
    justify-content: space-between;
}

.control-group label span {
    color: #ffffff;
    font-weight: 700;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    margin-top: -10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 2px #ffffff;
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #333333;
    border-radius: 3px;
}

/*/ --- Checkbox Toggle --- /*/
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(20, 20, 20, 0.5);
    border-radius: 12px;
    margin-bottom: 12px;
}
.toggle-row span {
    font-size: 14px;
    font-weight: 600;
    color: #cccccc;
}
/*/ Modern Toggle Switch /*/
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333333;
  transition: .4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #ffffff;
}
input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #000000;
}

/*/ --- Action Buttons --- /*/
.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

button.primary-btn, button.danger-btn, button.secondary-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.primary-btn {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

button.primary-btn:hover {
    background: #dddddd;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.4);
}

button.danger-btn {
    background: #555555;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(85, 85, 85, 0.2);
}

button.danger-btn:hover {
    background: #777777;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(85, 85, 85, 0.3);
}

button.secondary-btn {
    background: #333333;
    color: #ffffff;
}

button.secondary-btn:hover {
    background: #444444;
}

/*/ Screen Flasher for Light Mode /*/
#flasherOverlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: white;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.05s;
}

/*/ --- Koch Trainer Dashboard --- /*/
.dashboard {
    display: flex;
    justify-content: space-between;
    background: #111111;
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-box {
    text-align: center;
    flex: 1;
    border-right: 1px solid rgba(255,255,255,0.1);
}
.stat-box:last-child { border: none; }

.stat-label {
    display: block;
    font-size: 13px;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
}

.koch-input-area {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

#kochInput {
    font-size: 4rem;
    width: 150px;
    height: 150px;
    text-align: center;
    background: #000000;
    border: 3px solid #333333;
    color: #ffffff;
    border-radius: 24px;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: inset 0 4px 10px rgba(255,255,255,0.05);
}

#kochInput:focus {
    outline: none;
    border-color: #ffffff;
    box-shadow: inset 0 4px 10px rgba(255,255,255,0.05), 0 0 0 4px rgba(255, 255, 255, 0.2);
}

/*/ Animations /*/
.correct-feedback {
    animation: correctPulse 0.5s ease-out;
}
.wrong-feedback {
    animation: wrongShake 0.4s ease-in-out;
}

@keyframes correctPulse {
    0% { transform: scale(1); border-color: #333333; box-shadow: 0 0 0 transparent; }
    30% { transform: scale(1.1); border-color: #ffffff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
    100% { transform: scale(1); border-color: #ffffff; box-shadow: 0 0 0 transparent; }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); border-color: #ffffff; }
    20%, 60% { transform: translateX(-10px); border-color: #555555; box-shadow: 0 0 20px rgba(85, 85, 85, 0.5); }
    40%, 80% { transform: translateX(10px); border-color: #555555; box-shadow: 0 0 20px rgba(85, 85, 85, 0.5); }
}
/*/ --- Modern Inputs --- /*/
.modern-select, .modern-input {
    background: #000000;
    color: #ffffff;
    border: 1px solid #333333;
    padding: 10px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    width: 100%;
    transition: all 0.2s;
}

.modern-select:focus, .modern-input:focus {
    outline: none;
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/*/ --- Koch Split Layout --- /*/
.koch-split-layout {
    display: flex;
    gap: 24px;
    width: 100%;
    height: 100%;
    align-items: stretch;
}

.left-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem !important;
}

.settings-grid.single-col {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

#activeCharsDisplay {
    font-size: 1.2rem;
    color: #ffffff;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 2px;
    word-wrap: break-word;
    max-height: 80px;
    overflow-y: auto;
    margin-top: 8px;
}

/*/ Adjust input area for words /*/
#kochInput {
    font-size: 2.5rem;
    width: 100%;
    max-width: 500px;
    height: 100px;
}

/*/ --- Footer --- /*/
footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: auto;
}

footer p {
    color: #888888;
    font-size: 0.9rem;
    font-weight: 500;
}

/*/ --- Responsive Design --- /*/
@media (max-width: 900px) {
    body {
        height: auto;
        overflow-y: auto;
    }
    .main {
        flex-direction: column;
        padding: 0 15px 15px;
        overflow: visible;
    }
    .koch-split-layout {
        flex-direction: column;
    }
    .edu-card {
        padding: 1.5rem;
        flex: none !important;
        width: 100%;
    }
    .right-panel, .left-panel {
        flex: none !important;
        width: 100%;
    }
    nav {
        padding: 1rem 1.5rem;
    }
    nav h1 {
        font-size: 1.3rem;
    }
    .settings-grid {
        grid-template-columns: 1fr; /*/ Single col for Translator settings /*/
    }
}

@media (max-width: 600px) {
    .dashboard {
        flex-direction: column;
        gap: 15px;
    }
    .stat-box {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 10px;
    }
    .stat-box:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    .actions {
        flex-direction: column;
    }
    button.primary-btn, button.danger-btn, button.secondary-btn {
        max-width: 100%;
    }
    #kochInput {
        font-size: 2rem;
        height: 80px;
    }
    .master-toggle {
        flex-direction: column;
        width: 90%;
        border-radius: 16px;
    }
    .master-toggle button {
        border-radius: 12px;
    }
}
