/* Hindi Font Converter - Styles */

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --success-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 1.75rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

header p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.privacy-note {
    font-size: 0.8rem !important;
    color: var(--success) !important;
    margin-top: 0.5rem;
}

/* Disclaimer */
.disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.disclaimer-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.disclaimer-text {
    font-size: 0.9rem;
    color: #991b1b;
    line-height: 1.5;
}

.disclaimer-text strong {
    color: #7f1d1d;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg);
    color: var(--text);
}

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

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.preview-card {
    background: var(--card-bg);
}

.preview-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.preview-card .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* Converter Header */
.converter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.source-label,
.target-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.label-icon {
    font-size: 1.25rem;
}

.swap-direction-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--primary);
    background: white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.swap-icon {
    font-size: 1.25rem;
}

.direction-select select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Text Converter Grid */
.text-converter-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: stretch;
}

.text-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

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

.panel-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.panel-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

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

.text-area {
    flex: 1;
    min-height: 200px;
    padding: 0.75rem;
    border: none;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
}

.text-area:focus {
    outline: none;
}

.output-area {
    background: #fafbfc;
}

.panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Convert Actions */
.convert-actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

.convert-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.convert-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

/* Krutidev Preview */
.krutidev-preview {
    font-family: 'Kruti Dev 010', 'Krutidev', 'Kruti Dev', monospace;
    font-size: 1.25rem;
    line-height: 1.8;
    padding: 1rem;
    background: #fefce8;
    border: 1px dashed #fbbf24;
    border-radius: var(--radius-sm);
    min-height: 60px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

/* File Upload */
.file-upload-container {
    margin-bottom: 1rem;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.upload-zone h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.upload-zone p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.browse-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

/* File Selected */
.file-selected {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.file-icon {
    font-size: 2rem;
}

.file-details {
    flex: 1;
}

.file-name {
    display: block;
    font-weight: 500;
    color: var(--text);
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.remove-file-btn {
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--danger);
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.remove-file-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* File Actions */
.file-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-download {
    background: var(--success);
    color: white;
    flex: 1;
    justify-content: center;
}

.btn-download:hover {
    background: var(--success-dark);
}

.btn-icon {
    font-size: 1.1rem;
}

/* Download Section */
.download-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.download-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.download-buttons {
    display: flex;
    gap: 0.75rem;
}

/* File Preview */
.file-preview {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.file-preview .placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

/* Status Messages */
.status {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: 0.9rem;
    display: none;
}

.status.show {
    display: block;
}

.status.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-dark);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status.processing {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.footer-links {
    margin-top: 0.5rem;
}

.footer-links .separator {
    margin: 0 0.5rem;
    color: var(--text-muted);
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-note code {
    background: var(--bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.75rem;
}

/* Font Settings Card */
.font-settings-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
}

.font-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.font-settings-header h3 {
    font-size: 1rem;
    color: var(--text);
    margin: 0;
}

.font-status {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.font-status.loaded {
    background: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

.font-upload-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

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

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.status.show {
    animation: fadeIn 0.2s ease;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .text-converter-grid {
        grid-template-columns: 1fr;
    }

    .convert-actions {
        padding: 0.5rem 0;
    }

    .convert-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }

    .converter-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .download-buttons {
        flex-direction: column;
    }

    .tabs {
        flex-direction: column;
    }

    .font-upload-row {
        flex-direction: column;
    }

    .font-upload-row .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    :root {
        --radius: 10px;
        --radius-sm: 6px;
    }

    .container {
        padding: 0.75rem;
    }

    /* Header */
    header {
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 1.25rem;
        line-height: 1.3;
    }

    header p {
        font-size: 0.85rem;
    }

    .privacy-note {
        font-size: 0.75rem !important;
    }

    /* Disclaimer */
    .disclaimer {
        padding: 0.75rem;
        margin-bottom: 1rem;
        gap: 0.5rem;
    }

    .disclaimer-icon {
        font-size: 1rem;
    }

    .disclaimer-text {
        font-size: 0.8rem;
    }

    /* Tabs */
    .tabs {
        padding: 0.35rem;
        gap: 0.35rem;
        margin-bottom: 1rem;
    }

    .tab-btn {
        padding: 0.65rem 0.5rem;
        font-size: 0.85rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }

    /* Converter Header - Stack vertically on mobile */
    .converter-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .source-label,
    .target-label {
        justify-content: center;
        font-size: 0.9rem;
    }

    .label-icon {
        font-size: 1.1rem;
    }

    .swap-direction-btn {
        align-self: center;
        padding: 0.5rem 1.5rem;
    }

    .direction-select {
        width: 100%;
    }

    .direction-select select {
        width: 100%;
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    /* Text Panels */
    .text-panel {
        border-radius: var(--radius-sm);
    }

    .panel-header {
        padding: 0.5rem;
    }

    .panel-title {
        font-size: 0.8rem;
    }

    .panel-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
        min-height: 32px;
        min-width: 32px;
    }

    .text-area {
        min-height: 150px;
        padding: 0.65rem;
        font-size: 1rem;
        -webkit-text-size-adjust: 100%;
    }

    .panel-footer {
        padding: 0.5rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .char-count {
        font-size: 0.7rem;
    }

    /* Convert Button */
    .convert-btn {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

    /* Krutidev Preview */
    .krutidev-preview {
        font-size: 1.1rem;
        padding: 0.75rem;
        min-height: 50px;
    }

    .preview-card h3 {
        font-size: 0.9rem;
    }

    .preview-card .hint {
        font-size: 0.75rem;
    }

    /* File Upload */
    .upload-zone {
        padding: 1.5rem 1rem;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .upload-zone h3 {
        font-size: 0.9rem;
    }

    .upload-zone p {
        font-size: 0.8rem;
    }

    /* File Selected */
    .file-selected {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .file-icon {
        font-size: 1.5rem;
    }

    .file-name {
        font-size: 0.9rem;
        word-break: break-all;
    }

    .file-size {
        font-size: 0.75rem;
    }

    .remove-file-btn {
        padding: 0.5rem;
        font-size: 1.1rem;
    }

    /* Buttons */
    .btn {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
    }

    .btn-icon {
        font-size: 1rem;
    }

    /* Download Section */
    .download-section {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .download-section h3 {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .download-buttons {
        gap: 0.5rem;
    }

    /* File Preview */
    .file-preview {
        max-height: 200px;
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .file-preview .placeholder {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Status Messages */
    .status {
        padding: 0.65rem 0.75rem;
        font-size: 0.85rem;
        margin-top: 0.75rem;
    }

    /* Font Settings */
    .font-settings-card {
        padding: 0.875rem;
    }

    .font-settings-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .font-settings-header h3 {
        font-size: 0.9rem;
    }

    .font-status {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }

    .font-settings-card .hint {
        font-size: 0.75rem;
        line-height: 1.4;
    }

    .font-upload-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .font-upload-row .btn {
        width: 100%;
        justify-content: center;
        font-size: 0.85rem;
    }

    /* Footer */
    footer {
        padding: 1rem 0.5rem;
        font-size: 0.8rem;
    }

    .footer-note {
        font-size: 0.75rem;
    }

    .footer-note code {
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .container {
        padding: 0.5rem;
    }

    header h1 {
        font-size: 1.1rem;
    }

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

    .card {
        padding: 0.75rem;
    }

    .text-area {
        min-height: 120px;
        font-size: 0.95rem;
    }

    .btn {
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .tab-btn {
        min-height: 48px;
    }

    .panel-btn {
        min-height: 40px;
        min-width: 40px;
        padding: 0.5rem;
    }

    .swap-direction-btn {
        min-height: 44px;
        padding: 0.5rem 1.25rem;
    }

    .btn {
        min-height: 48px;
    }

    .convert-btn {
        min-height: 48px;
    }

    .remove-file-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Prevent zoom on input focus */
    .text-area,
    select,
    input {
        font-size: 16px;
    }
}

/* Safe area for notched phones */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .text-area {
        min-height: 100px;
    }

    .krutidev-preview {
        min-height: 40px;
    }

    .file-preview {
        max-height: 150px;
    }

    .upload-zone {
        padding: 1rem;
    }
}
