/**
 * Text Case Converter App Styles
 *
 * A production-ready text case converter with accessible, responsive design
 */

/* ========================================
   App Page Layout
   ======================================== */

.app-page {
    padding: var(--space-4);
    padding-top: calc(var(--header-height) + var(--space-4));
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
    align-items: center;
}

.app-container {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.app-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.app-header h1 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-2);
}

.app-description {
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: 0;
}

/* ========================================
   Text Case Converter
   ======================================== */

.text-case-converter {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* Text Input Area */
.tcc-input-area {
    padding: var(--space-4);
    background: var(--color-bg-card);
}

.tcc-textarea {
    width: 100%;
    min-height: 150px;
    padding: var(--space-4);
    font-size: var(--font-size-base);
    font-family: inherit;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    resize: vertical;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.tcc-textarea::placeholder {
    color: var(--color-text-muted);
}

.tcc-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Action Buttons */
.tcc-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-3);
}

.tcc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast), transform 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tcc-btn:active {
    transform: scale(0.98);
}

.tcc-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

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

.tcc-btn-secondary:hover {
    background: var(--color-border);
}

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

.tcc-btn-primary:hover {
    background: var(--color-primary-dark);
}

/* ========================================
   Case Conversion Buttons
   ======================================== */

.tcc-buttons {
    padding: var(--space-4);
    background: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
}

.tcc-buttons-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 var(--space-4) 0;
}

.tcc-buttons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
}

.tcc-case-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-2);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    min-height: 70px;
}

.tcc-case-btn:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.tcc-case-btn:focus-visible {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.tcc-case-btn:active {
    background: var(--color-bg-alt);
}

.tcc-case-btn.active {
    border-color: var(--color-primary);
    background: rgba(79, 70, 229, 0.05);
}

.tcc-case-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    font-family: var(--font-mono);
    white-space: nowrap;
}

.tcc-case-desc {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.3;
    display: none;
}

/* ========================================
   Output Section
   ======================================== */

.tcc-output {
    padding: var(--space-4);
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
}

.tcc-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.tcc-output-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.tcc-output-content {
    min-height: 100px;
    padding: var(--space-4);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.tcc-output-content:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-muted);
}

.tcc-output-content:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ========================================
   Accessibility Announcements
   ======================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .tcc-buttons-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .app-page {
        padding: var(--space-2);
        padding-top: calc(var(--header-height) + var(--space-2));
    }

    .app-header {
        margin-bottom: var(--space-4);
    }

    .tcc-textarea {
        min-height: 120px;
        font-size: var(--font-size-sm);
    }

    .tcc-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tcc-case-btn {
        padding: var(--space-3);
        min-height: 60px;
    }

    .tcc-output-content {
        min-height: 80px;
    }
}

@media (max-width: 400px) {
    .tcc-buttons-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }

    .tcc-case-name {
        font-size: var(--font-size-xs);
    }

    .tcc-actions {
        flex-direction: column;
    }

    .tcc-btn {
        width: 100%;
    }
}

/* Large screens - show descriptions */
@media (min-width: 900px) {
    .app-container {
        max-width: 900px;
    }

    .tcc-case-desc {
        display: block;
    }

    .tcc-case-btn {
        min-height: 85px;
    }
}

/* ========================================
   Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .tcc-btn,
    .tcc-textarea,
    .tcc-case-btn,
    .tcc-output-content {
        transition: none;
    }

    .tcc-btn:active {
        transform: none;
    }
}

/* ========================================
   Help Panel (Modal)
   ======================================== */

.help-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.help-panel[hidden] {
    display: none;
}

.help-content {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-bg-card);
}

.help-header h2 {
    font-size: var(--font-size-lg);
    margin: 0;
}

.help-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
}

.help-close:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

.help-close:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.help-body {
    padding: var(--space-6);
}

.help-section {
    margin-bottom: var(--space-6);
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-4);
    color: var(--color-text);
}

.help-steps {
    margin: 0;
    padding-left: var(--space-5);
}

.help-steps li {
    margin-bottom: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.help-features {
    margin: 0;
    padding-left: var(--space-5);
}

.help-features li {
    margin-bottom: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

/* ========================================
   Header Actions
   ======================================== */

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-icon:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .tcc-actions,
    .tcc-buttons,
    .help-panel,
    .nav-actions {
        display: none;
    }

    .text-case-converter {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .tcc-output {
        background: white;
    }

    .tcc-output-content {
        border: 1px solid #ccc;
    }
}
