/* Modern Color Palette */
:root {
    --primary-color: #4a6fa5;
    --primary-light: #7b9ed9;
    --primary-dark: #1a4b8c;
    --secondary-color: #6c5b7b;
    --accent-color: #c06c84;
    --background-start: #2c3e50;
    --background-end: #4a6fa5;
    --text-primary: #2c3e50;
    --text-secondary: #5d6d7e;
    --text-light: #ecf0f1;
    --border-color: #d5d8dc;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background: linear-gradient(135deg, var(--background-start) 0%, var(--background-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.header {
    margin-bottom: 0.3rem;
    width: 100%;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    max-width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.logo {
    height: 40px;
    width: auto;
    border-radius: 4px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.logo:hover {
    transform: scale(1.05);
}

.header-text {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-text h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
}

.tabs {
    display: flex;
    background: rgba(255,255,255,0.1);
    border-radius: 15px 15px 0 0;
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.tab-button {
    flex: 1;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 6px 6px 0 0;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.tab-button.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    background: rgba(255,255,255,0.95);
    border-radius: 0 0 15px 15px;
    min-height: 600px;
    padding: 30px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
    background: #ccc;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-dark);
}

.toggle-switch.active:hover {
    background-color: var(--primary-dark);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(30px);
}

.text-area {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    width: 100%;
    min-height: 200px;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    resize: vertical;
    transition: border-color 0.3s;
    background-color: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.text-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.25);
}

.text-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 0;
    margin-right: 0;
    margin-bottom: 5px;
    margin-left: 0;
    padding: 0px 0;
    border-bottom: 1px solid #eee;
}

.control-btn {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.control-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.keyboard {
    display: grid;
    gap: 5px;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2px;
}

.keyboard-row {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
}

.key {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    font-size: 16px;
    padding: 8px 4px;
    min-width: 35px;
    height: 45px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    max-width: 60px;
    color: var(--text-primary);
}

.key:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.key:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.key.special-char {
    background: linear-gradient(145deg, #f8d5e4, #f2a8c2);
    color: var(--primary-dark);
    font-weight: 600;
}

.key.space {
    min-width: 120px;
    max-width: 200px;
    flex-grow: 3;
}

.key.enter, .key.shift, .key.backspace, .key.delete {
    font-size: 0.9em;
    min-width: 50px;
}

.key.enter {
    min-width: 50px;
    font-size: 1.2em;
    background: linear-gradient(145deg, #e6e6e6, #c7c7c7);
}

.key.enter:hover {
    background: linear-gradient(145deg, #d9d9d9, #b8b8b8);
}

.key.enter:active {
    background: linear-gradient(145deg, #c7c7c7, #a8a8a8);
}

.key.shift {
    min-width: 50px;
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    color: var(--primary-dark);
    font-weight: 600;
}

.key.shift.active {
    background: linear-gradient(145deg, #bbdefb, #90caf9);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.key.shift svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

@media (max-width: 480px) {
    .key {
        min-width: 30px;
        height: 40px;
        font-size: 0.9em;
        padding: 5px 2px;
    }

    .key.space {
        min-width: 100px;
    }

    .key.enter, .key.shift, .key.backspace, .key.delete {
        font-size: 0.8em;
        min-width: 45px;
    }

    .keyboard {
        gap: 3px;
    }

    .keyboard-row {
        gap: 2px;
    }
}

@media (max-width: 360px) {
    .key {
        min-width: 25px;
        height: 38px;
        font-size: 0.85em;
        padding: 4px 1px;
    }

    .key.space {
        min-width: 80px;
    }
    .header-content {
        flex-wrap: nowrap;
    }

    .logo {
        height: 28px;
    }

    .header-text h1 {
        font-size: 1rem;
    }

}

@media (max-height: 500px) and (orientation: landscape) {
    .key {
        height: 35px;
        font-size: 0.8em;
    }

    .keyboard {
        gap: 2px;
    }

    .keyboard-row {
        gap: 1px;
    }
}

.learning-content {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.learning-content::-webkit-scrollbar {
    width: 8px;
}

.learning-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.learning-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.learning-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.learning-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    padding: 15px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-items: center;
    flex-wrap: wrap;
}

.char-button, .word-button {
    font-family: 'Segoe UI', 'Noto Sans', 'DejaVu Sans', 'Droid Sans', 'Liberation Sans', Arial, sans-serif;
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 60px;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.char-button {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
}

.char-button:hover {
    background: linear-gradient(145deg, #5a6fd8, #6a4190);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.word-button {
    background: linear-gradient(145deg, #ffeaa7, #fab1a0);
    color: #2d3436;
}

.word-button:hover {
    background: linear-gradient(145deg, #fdcb6e, #e17055);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(253, 203, 110, 0.3);
}

.highlight {
    color: #e74c3c;
    font-weight: bold;
    background: rgba(231, 76, 60, 0.1);
    padding: 0px 0px;
    border-radius: 3px;
}

/* Learning Tab Styles */
.learning-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 15px;
}

.character-section, .word-section {
    margin-bottom: 2rem;
}

.section-title {
    color: var(--primary-color);
    font-size: 1.2em;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.character-buttons, .word-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}

.char-button, .word-button {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.char-button:hover, .word-button:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.char-button:active, .word-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Character-specific styling */
.char-button {
    font-size: 1.4em;
    padding: 15px 0;
    font-weight: 500;
}

/* Word-specific styling */
.word-button {
    font-size: 1em;
    padding: 10px 5px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

/* Responsive adjustments for learning tab */
@media (max-width: 768px) {
    .character-buttons, .word-buttons {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }

    .char-button {
        font-size: 1.2em;
        padding: 12px 0;
    }

    .word-button {
        font-size: 0.9em;
        padding: 8px 4px;
        min-height: 50px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header-content {
        gap: 0.75rem;
        padding: 0.5rem;
    }

    .logo {
        height: 36px;
    }

    .header-text h1 {
        font-size: 1.3rem;
    }

    .tab-content {
        padding: 20px;
        min-height: 500px;
    }

    .text-area {
        min-height: 150px;
        font-size: 1em;
    }

    .key {
        min-width: 35px;
        height: 40px;
        font-size: 1em;
        padding: 8px;
    }

    .key.space {
        min-width: 150px;
    }

    .learning-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .char-button, .word-button {
        width: 100%;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .header-content {
        gap: 0.5rem;
    }

    .logo {
        height: 32px;
    }

    .header-text h1 {
        font-size: 1.1rem;
    }

    .tab-button {
        font-size: 1em;
        padding: 12px 15px;
    }

    .key {
        min-width: 30px;
        height: 35px;
        font-size: 0.9em;
    }

    .key.space {
        min-width: 120px;
    }
}

footer {
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.5rem;
    color: white;
    font-size: 0.9rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .key {
        padding: 6px 2px;
        min-width: 30px;
        height: 40px;
        font-size: 14px;
    }

    .tab-button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
}

/* keyboard_pro.css */

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #7b9ed9; /* A lighter primary for dark mode */
        --background-start: #1a1a2e;
        --background-end: #0f0f1a;
        --text-primary: #ecf0f1;
        --text-secondary: #bdc3c7;
        --border-color: #444;
        /* ... override other variables for dark mode */
    }
    /* You might also need to adjust specific element styles */
    .tab-button.active {
        background: var(--primary-dark); /* Darker background for active tab in dark mode */
        color: white;
    }
    .text-area {
        background-color: #333;
        color: #eee;
        border-color: #555;
    }
    /* Adjust other elements as needed */
}
