/**
 * ConvMaster - NATO Alphabet & Code Converter Styles
 * 
 * @package    ConvMaster
 * @version    1.0.0
 */

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-header__icon {
    font-size: 2.5rem;
}

.tool-header__icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
}

.tool-header__icon .icon--nato {
    background: linear-gradient(135deg, rgba(75, 85, 99, 0.3), rgba(55, 65, 81, 0.3));
}

.tool-header__text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tool-header__text p {
    margin: 0;
    color: var(--text-secondary);
}

/* =====================================================
   CURRENT DATE DISPLAY
   ===================================================== */
.current-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.current-date__icon {
    font-size: 1.1rem;
}

.current-date__text {
    font-weight: 500;
}

/* =====================================================
   NATO CONVERTER WIDGET
   ===================================================== */
.nato-converter {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.nato-converter__input-section,
.nato-converter__modes-section,
.nato-converter__results-section {
    margin-bottom: 1.5rem;
}

.nato-converter__section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.nato-converter__step-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.nato-converter__section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* =====================================================
   INPUT AREA
   ===================================================== */
.nato-input-area {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.nato-input {
    width: 100%;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease;
}

.nato-input:focus {
    outline: none;
    border-color: var(--primary);
}

.nato-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.nato-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.char-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* =====================================================
   QUICK EXAMPLES
   ===================================================== */
.quick-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.quick-examples__label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.example-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* =====================================================
   MODE TOGGLES
   ===================================================== */
.mode-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.mode-toggle {
    cursor: pointer;
}

.mode-toggle input {
    display: none;
}

.mode-toggle__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.mode-toggle input:checked + .mode-toggle__box {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

.mode-toggle__icon {
    font-size: 1.5rem;
}

.mode-toggle__label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.mode-toggle input:checked + .mode-toggle__box .mode-toggle__label {
    color: var(--primary);
}

.mode-toggle:hover .mode-toggle__box {
    border-color: var(--text-muted);
}

/* =====================================================
   RESULTS CONTAINER
   ===================================================== */
.results-container {
    min-height: 150px;
}

.results-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
}

.results-placeholder__icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.results-placeholder p {
    color: var(--text-muted);
    margin: 0;
}

/* Result Card */
.result-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

.result-card:last-child {
    margin-bottom: 0;
}

.result-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.result-card__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-card__title span {
    font-size: 1.1rem;
}

.result-card__actions {
    display: flex;
    gap: 0.5rem;
}

.result-card__body {
    padding: 1rem;
}

/* NATO/Morse Text Result */
.result-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-primary);
    word-break: break-word;
}

.result-text .word-group {
    display: inline;
}

.result-text .word-separator {
    display: inline-block;
    width: 1.5em;
}

.result-text .letter-separator {
    color: var(--text-muted);
}

/* Visual Results (Semaphore, Braille, Flags) */
.result-visual {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-start;
}

.visual-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 50px;
}

.visual-item__symbol {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1.5rem;
}

.visual-item__label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Word Space in Visual */
.visual-item--space {
    min-width: 30px;
}

.visual-item--space .visual-item__symbol {
    background: transparent;
    border: none;
    width: 30px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Semaphore specific */
.semaphore-symbol {
    position: relative;
    width: 40px;
    height: 40px;
}

.semaphore-symbol svg {
    width: 100%;
    height: 100%;
}

/* Braille specific */
.braille-symbol {
    font-size: 2rem;
    line-height: 1;
}

/* Flag specific */
.flag-symbol {
    width: 40px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.flag-symbol img,
.flag-symbol svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Panel signal specific */
.panel-symbol {
    display: grid;
    grid-template-columns: repeat(3, 10px);
    grid-template-rows: repeat(3, 10px);
    gap: 2px;
}

.panel-cell {
    background: var(--border-color);
    border-radius: 1px;
}

.panel-cell--active {
    background: var(--text-primary);
}

/* =====================================================
   ACTION BUTTONS
   ===================================================== */
.nato-converter__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn--primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn--secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn--secondary:hover {
    background: var(--bg-secondary);
}

.btn--outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn--outline:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
}

.btn--small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn--icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn--icon:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn--icon.playing {
    color: var(--error);
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    animation: pulse-playing 1s ease-in-out infinite;
}

@keyframes pulse-playing {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.btn svg {
    flex-shrink: 0;
}

/* Inline Notification */
.inline-notification {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.inline-notification--success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.inline-notification--error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Privacy Info */
.nato-converter__info {
    text-align: center;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--radius-md);
}

.nato-converter__info p {
    font-size: 0.8rem;
    color: var(--success);
    margin: 0;
}

/* =====================================================
   REFERENCE TABLES
   ===================================================== */
.reference-tables {
    margin-top: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.reference-tables__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.reference-tables__header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.reference-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reference-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.reference-tab:hover {
    background: var(--bg-secondary);
}

.reference-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.reference-content {
    padding: 1.5rem;
}

.reference-grid {
    display: grid;
    gap: 0.5rem;
}

.reference-grid--nato,
.reference-grid--morse {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.reference-grid--braille {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}

.reference-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.reference-item__letter {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.reference-item__value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
}

.reference-item--braille .reference-item__value {
    font-size: 1.5rem;
}

/* Visual reference items (semaphore, flags, panel) */
.reference-item--visual {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    min-width: 70px;
}

.reference-item--visual .reference-item__letter {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
}

.reference-item__svg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.reference-item__svg svg {
    width: 40px;
    height: 40px;
}

.reference-item__panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mini panel grid for reference */
.panel-grid-mini {
    display: grid;
    grid-template-columns: repeat(3, 10px);
    grid-template-rows: repeat(3, 10px);
    gap: 1px;
    background: var(--border-color);
    padding: 1px;
    border-radius: 2px;
}

.panel-cell-mini {
    background: var(--bg-secondary);
}

.panel-cell-mini--active {
    background: var(--text-primary);
}

/* Reference grids for visual items */
.reference-grid--semaphore,
.reference-grid--flags,
.reference-grid--panel {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
}

/* =====================================================
   SEO CONTENT
   ===================================================== */
.tool-content {
    margin-top: 3rem;
}

.tool-section {
    margin-bottom: 2.5rem;
}

.tool-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.tool-section p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.feature-card__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.step-card__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.faq-item summary {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-muted);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.5rem 1rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* =====================================================
   HIDDEN ELEMENTS
   ===================================================== */
[hidden] {
    display: none !important;
}

/* =====================================================
   INPUT NUMBER SPINNERS REMOVAL
   ===================================================== */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .tool-page {
        padding: 1rem;
    }
    
    .tool-header {
        flex-direction: column;
        text-align: center;
    }
    
    .mode-toggles {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nato-converter__actions {
        flex-direction: column;
    }
    
    .nato-converter__actions .btn {
        width: 100%;
    }
    
    .reference-tables__header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .reference-tabs {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .mode-toggles {
        grid-template-columns: 1fr;
    }
    
    .visual-item__symbol {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .reference-grid--nato,
    .reference-grid--morse {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .reference-grid--semaphore,
    .reference-grid--flags,
    .reference-grid--panel {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =====================================================
   LIGHT THEME ADJUSTMENTS
   ===================================================== */
[data-theme="light"] .nato-input {
    background: var(--bg-primary);
}

[data-theme="light"] .nato-converter__input-section,
[data-theme="light"] .mode-toggle__box,
[data-theme="light"] .result-card,
[data-theme="light"] .reference-item {
    background: var(--bg-secondary);
}

[data-theme="light"] .visual-item__symbol {
    background: white;
}

[data-theme="light"] .result-card__header {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .panel-cell-mini {
    background: var(--bg-tertiary);
}

[data-theme="light"] .panel-cell-mini--active {
    background: var(--text-primary);
}
