/* Vail Master - Main Layout Styles */

/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Main app container */
.app-container {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background-color: #363636;
    border-bottom: 1px solid #4a4a4a;
    gap: 1rem;
}

.app-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0af;
    margin: 0;
}

/* How to Use button in header */
.button-help {
    background-color: transparent;
    border: 1px solid #4a4a4a;
    color: #999;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.button-help:hover {
    border-color: #086;
    color: #086;
    background-color: rgba(0, 134, 102, 0.1);
}

/* Vail Adapter Banner (Top) */
.adapter-banner {
    background: linear-gradient(135deg, #1a3a52 0%, #2a4a62 100%);
    border-bottom: 1px solid #4a6a82;
    padding: 0.875rem 1.5rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.adapter-banner a {
    color: #0af;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
}

.adapter-banner a:hover {
    color: #5df;
    text-decoration: underline;
}

.adapter-icon {
    font-size: 1.3rem;
}

/* Main content area */
.main-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Practice area (left side) */
.practice-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Target and Echo display */
.text-display {
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.text-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.text-row:last-child {
    margin-bottom: 0;
}

.text-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    min-width: 60px;
    padding-top: 0.25rem;
}

.text-content {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1.5rem;
    line-height: 1.4;
    color: #e0e0e0;
    background-color: #0a0a0a;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    min-height: 3rem;
    width: 600px; /* Fixed width to match echo box */
    max-width: 100%; /* Responsive on small screens */
}

/* Echo ticker with scrolling */
.echo-container {
    overflow: hidden;
    position: relative;
    width: 600px; /* Fixed width to prevent expansion */
    max-width: 100%; /* Responsive on small screens */
}

.echo-content {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1.5rem;
    line-height: 1.4;
    color: #e0e0e0;
    background-color: #0a0a0a;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    min-height: 3rem;
    white-space: nowrap;
    overflow-x: scroll;
    overflow-y: hidden;
    width: 100%; /* Force content to match container width */
    max-width: 100%; /* Never exceed container */
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
}

.echo-content::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

.echo-content span {
    /* Span contains the text and can grow as needed */
}

/* Ready indicator */
.ready-indicator {
    text-align: center;
    padding: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.ready-indicator.is-ready {
    color: #0af;
}

.ready-indicator.is-active {
    color: #2ecc71;
}

/* Controls and Scoreboard row */
.controls-row {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
}

/* Scoreboard */
.scoreboard {
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.scoreboard-title {
    font-size: 1rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #3a3a3a;
}

.scoreboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
}

.scoreboard-label {
    color: #999;
    font-size: 0.875rem;
}

.scoreboard-value {
    color: #e0e0e0;
    font-weight: 600;
}

.scoreboard-value.highlight {
    color: #0af;
}

/* Controls panel */
.controls-panel {
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.control-group {
    margin-bottom: 1rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.control-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
}

.control-value {
    font-size: 0.875rem;
    color: #0af;
    font-weight: 600;
}

/* Slider with value display */
.slider-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.slider-control input[type="range"] {
    flex: 1;
}

.slider-control .value-display {
    min-width: 60px;
    text-align: right;
    font-family: monospace;
    color: #0af;
    font-weight: 600;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #3a3a3a;
}

.action-buttons button {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Score history panel (right side) */
.score-panel {
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}

.score-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #3a3a3a;
}

/* Mode tabs in score panel */
.score-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.score-tabs button {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    background-color: #2a2a2a;
    border: none;
    border-radius: 4px;
    color: #999;
    cursor: pointer;
}

.score-tabs button:hover {
    background-color: #3a3a3a;
}

.score-tabs button.is-active {
    background-color: #086;
    color: white;
}

/* Run length selector */
.run-length-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.run-length-selector button {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    background-color: transparent;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #999;
    cursor: pointer;
}

.run-length-selector button:hover {
    border-color: #086;
    color: #e0e0e0;
}

.run-length-selector button.is-active {
    border-color: #086;
    background-color: rgba(0, 134, 102, 0.2);
    color: #086;
}

/* Score table */
.score-table-container {
    flex: 1;
    overflow-y: auto;
}

.score-table {
    width: 100%;
    font-size: 0.8125rem;
}

.score-table th {
    font-size: 0.6875rem;
    padding: 0.5rem 0.375rem;
    position: sticky;
    top: 0;
    background-color: #1a1a1a;
}

.score-table td {
    padding: 0.375rem;
}

/* Touch buttons for mobile */
.touch-buttons {
    display: none;
    gap: 1rem;
    padding: 1rem;
    justify-content: center;
}

.touch-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.touch-button.dit {
    background-color: #086;
}

.touch-button.dah {
    background-color: #097;
}

.touch-button.straight {
    background-color: #2a2a2a;
    border: 2px solid #086;
}

.touch-button:active {
    transform: scale(0.95);
}

/* Character set editor */
.charset-editor {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.charset-char {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    font-weight: bold;
}

.charset-char.selected {
    background-color: #086;
    border-color: #086;
    color: white;
}

.charset-char:hover {
    border-color: #086;
}

/* Advanced settings collapsible section */
.advanced-section {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.advanced-toggle {
    cursor: pointer;
    color: #999;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 0.5rem 0;
    user-select: none;
}

.advanced-toggle:hover {
    color: #0af;
}

.advanced-toggle::marker {
    color: #666;
}

.advanced-content {
    padding: 0.75rem 0;
    border-top: 1px solid #3a3a3a;
    margin-top: 0.5rem;
}

.advanced-help {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #666;
}

/* Analytics section */
.analytics-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #3a3a3a;
}

.problem-chars {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.problem-char {
    padding: 0.25rem 0.5rem;
    background-color: rgba(255, 56, 96, 0.2);
    border: 1px solid rgba(255, 56, 96, 0.4);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
}

/* Responsive design */
@media screen and (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .score-panel {
        max-height: none;
    }

    .controls-row {
        grid-template-columns: 1fr;
    }

    .touch-buttons {
        display: flex;
    }
}

@media screen and (max-width: 600px) {
    .app-header {
        padding: 0.5rem 1rem;
    }

    .app-title {
        font-size: 1.25rem;
    }

    .adapter-banner {
        font-size: 0.85rem;
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .adapter-icon {
        font-size: 1.5rem;
    }

    .main-content {
        padding: 1rem;
        gap: 1rem;
    }

    .text-content,
    .echo-content {
        font-size: 1.25rem;
        padding: 0.5rem 0.75rem;
    }

    .control-row {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .touch-button {
        width: 70px;
        height: 70px;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }

    .footer-content {
        padding: 1.5rem 1rem;
    }
}

/* Footer */
.app-footer {
    background-color: #2a2a2a;
    border-top: 1px solid #4a4a4a;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    text-align: center;
}

.footer-credits {
    margin-bottom: 1rem;
}

.footer-credit {
    color: #999;
    font-size: 0.9rem;
    margin: 0.25rem 0;
    line-height: 1.6;
}

.footer-credit strong {
    color: #0af;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #999;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    white-space: nowrap;
}

.footer-link:hover {
    color: #0af;
}

.footer-link-icon {
    font-size: 1.1rem;
}

.footer-coffee {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Override BMC button styling to ensure centering */
.footer-coffee .bmc-button {
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
}

/* Print styles */
@media print {
    .app-header,
    .app-footer,
    .adapter-banner,
    .controls-panel,
    .touch-buttons,
    .action-buttons {
        display: none;
    }

    .main-content {
        display: block;
    }

    .score-panel {
        break-inside: avoid;
    }
}
