/* ============================================================
   Universal Indian Font Converter — Optimized Frontend Styles
   ============================================================ */

/* ── 1. CSS Variables & Reset ────────────────────────────── */
:root {
    /* Color Tokens */
    --uifc-blue:         #1a6fc4;
    --uifc-blue-light:   #e8f2fb;
    --uifc-blue-dark:    #104e8b;
    --uifc-purple:       #6d28d9;
    --uifc-purple-light: #f0ebff;
    --uifc-purple-dark:  #4c1d95;
    --uifc-green:        #16a34a;
    --uifc-green-dark:   #15803d;
    --uifc-red:          #dc2626;
    --uifc-red-dark:     #b91c1c;
    --uifc-orange:       #ea580c;
    
    /* Neutral Tokens */
    --uifc-text:         #1e293b;
    --uifc-muted:        #64748b;
    --uifc-border:       #e2e8f0;
    --uifc-bg:           #f8fafc;
    --uifc-white:        #ffffff;
    
    /* UI Elements */
    --uifc-radius:       10px;
    --uifc-trans:        0.2s ease-in-out;
    
    /* Shadows */
    --uifc-shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --uifc-shadow-md:    0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
    --uifc-shadow-lg:    0 10px 30px rgba(0, 0, 0, 0.10), 0 4px 10px rgba(0, 0, 0, 0.06);
}

.uifc-wrapper-modern *,
.uifc-wrapper-modern *::before,
.uifc-wrapper-modern *::after {
    box-sizing: border-box;
}

/* ── 2. Wrapper & Header ─────────────────────────────────── */
.uifc-wrapper-modern {
    max-width: 1020px;
    margin: 30px auto;
    padding: 0;
    background: var(--uifc-bg);
    border-radius: 16px;
    box-shadow: var(--uifc-shadow-lg);
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    color: var(--uifc-text);
    overflow: hidden;
}

.uifc-header {
    background: linear-gradient(135deg, var(--uifc-blue) 0%, var(--uifc-purple) 100%);
    padding: 22px 30px;
    text-align: center;
}

.uifc-header h2 {
    color: #ffffff !important; /* Header text color explicitly set to white */
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* ── 3. Font Selectors (Shared & Specific) ───────────────── */
#uifc-top-font-wrap {
    background: var(--uifc-white);
    border-bottom: 2px solid var(--uifc-border);
    padding: 18px 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

#uifc-top-font-wrap label {
    font-size: 13px;
    font-weight: 700;
    color: var(--uifc-blue-dark);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

.uifc-modern-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--uifc-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%231a6fc4' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 12px center;
    background-size: 18px;
    border: 2px solid var(--uifc-border);
    border-radius: 8px;
    padding: 9px 40px 9px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--uifc-text);
    cursor: pointer;
    transition: all var(--uifc-trans);
    min-width: 220px;
}

.uifc-modern-select:hover {
    border-color: var(--uifc-blue);
}

.uifc-modern-select:focus {
    outline: none;
    border-color: var(--uifc-blue);
    box-shadow: 0 0 0 3px rgba(26, 111, 196, 0.18);
}

#uifc-top-font-wrap .uifc-modern-select {
    flex: 1;
    max-width: 480px;
    font-size: 15px;
    padding: 10px 44px 10px 16px;
    border-radius: 10px;
    border-color: var(--uifc-blue);
    box-shadow: var(--uifc-shadow-sm);
}

#uifc-top-font-wrap .uifc-modern-select:focus {
    box-shadow: 0 0 0 4px rgba(26, 111, 196, 0.2);
}

/* ── 4. Text Converter Section (Blue Accent) ─────────────── */
.uifc-text-converter-section {
    padding: 24px 28px 20px;
    border-left: 5px solid var(--uifc-blue);
    background: linear-gradient(to right, var(--uifc-blue-light) 0%, var(--uifc-white) 55%);
    border-bottom: 1px dashed #b6d4f5;
    position: relative;
}

.uifc-text-converter-section::before {
    content: "✦ Text Converter";
    position: absolute;
    top: 14px; 
    right: 22px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--uifc-blue);
    opacity: 0.55;
}

.uifc-editor-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

/* ── 5. Bulk File Converter Section (Purple Accent) ──────── */
.uifc-file-upload-modern {
    margin: 0;
    padding: 24px 28px 28px;
    border-left: 5px solid var(--uifc-purple);
    background: linear-gradient(to right, var(--uifc-purple-light) 0%, var(--uifc-white) 60%);
    border-top: 1px dashed #c4b5fd;
    position: relative;
    text-align: center; /* Centering text for bulk section */
}

.uifc-file-upload-modern::before {
    content: "⬆ Bulk File Converter";
    position: absolute;
    top: 14px; 
    right: 22px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--uifc-purple);
    opacity: 0.55;
}

.uifc-file-upload-modern h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--uifc-purple-dark);
    display: flex;
    align-items: center;
    justify-content: center; /* Centering heading icon and text */
    gap: 8px;
}

.uifc-file-upload-modern > p {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--uifc-muted);
}

.uifc-bulk-font-selector {
    background: var(--uifc-white);
    border: 2px solid var(--uifc-purple);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center; /* Centering bulk font selector items */
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    box-shadow: var(--uifc-shadow-sm);
}

.uifc-bulk-font-selector label {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--uifc-purple-dark);
    white-space: nowrap;
}

.uifc-bulk-font-selector .uifc-modern-select {
    flex: 1;
    min-width: 200px;
    border-color: var(--uifc-purple);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24'%3E%3Cpath fill='%236d28d9' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

.uifc-bulk-font-selector .uifc-modern-select:hover {
    border-color: var(--uifc-purple-dark);
}

.uifc-bulk-font-selector .uifc-modern-select:focus {
    border-color: var(--uifc-purple-dark);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.18);
}

.uifc-synced-select.syncing {
    animation: uifc-sync-pulse 0.35s ease;
}

@keyframes uifc-sync-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(26, 111, 196, 0.45); }
    70%  { box-shadow: 0 0 0 8px rgba(26, 111, 196, 0); }
    100% { box-shadow: 0 0 0 0 rgba(26, 111, 196, 0); }
}

/* ── 6. Textarea Cards ───────────────────────────────────── */
.uifc-card {
    background: var(--uifc-white);
    border: 1.5px solid var(--uifc-border);
    border-top: 3px solid var(--uifc-blue);
    border-radius: var(--uifc-radius);
    box-shadow: var(--uifc-shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--uifc-trans);
}

.uifc-card:hover {
    box-shadow: var(--uifc-shadow-md);
}

.uifc-card:nth-child(2) {
    border-top-color: var(--uifc-orange);
}

.uifc-card-header {
    background: linear-gradient(90deg, #f1f8ff 0%, var(--uifc-bg) 100%);
    padding: 11px 15px;
    font-size: 13px;
    font-weight: 700;
    color: var(--uifc-blue-dark);
    border-bottom: 1px solid var(--uifc-border);
    display: flex;
    align-items: center;
    gap: 7px;
}

.uifc-card:nth-child(2) .uifc-card-header {
    background: linear-gradient(90deg, #fff8f5 0%, var(--uifc-bg) 100%);
    color: var(--uifc-orange);
}

.uifc-card textarea {
    width: 100%;
    height: 240px;
    padding: 14px 16px;
    border: none;
    resize: vertical;
    font-size: 16px;
    line-height: 1.7;
    color: var(--uifc-text);
    background: #fdfdfd;
    transition: background var(--uifc-trans);
}

.uifc-card textarea:focus {
    outline: none;
    background: var(--uifc-white);
}

/* ── 7. Buttons ──────────────────────────────────────────── */
.uifc-button-group {
    padding: 10px 12px;
    background: var(--uifc-bg);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid var(--uifc-border);
}

.uifc-button-group button,
.btn-convert,
.btn-copy,
.btn-clear {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--uifc-trans);
    letter-spacing: 0.2px;
}

.uifc-button-group button:active,
#uifc-upload-btn:active { 
    transform: scale(0.96); 
}

/* Button Variants */
.btn-convert {
    background: linear-gradient(135deg, var(--uifc-blue) 0%, #2563eb 100%);
    color: var(--uifc-white);
    box-shadow: 0 2px 6px rgba(26, 111, 196, 0.35);
}

.btn-convert:hover {
    background: linear-gradient(135deg, var(--uifc-blue-dark) 0%, #1d4ed8 100%);
    box-shadow: 0 3px 10px rgba(26, 111, 196, 0.45);
}

.btn-copy {
    background: linear-gradient(135deg, var(--uifc-green) 0%, var(--uifc-green-dark) 100%);
    color: var(--uifc-white);
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.btn-copy:hover {
    background: linear-gradient(135deg, var(--uifc-green-dark) 0%, #14532d 100%);
}

.btn-clear {
    background: linear-gradient(135deg, var(--uifc-red) 0%, var(--uifc-red-dark) 100%);
    color: var(--uifc-white);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.btn-clear:hover {
    background: linear-gradient(135deg, var(--uifc-red-dark) 0%, #991b1b 100%);
}

#uifc-upload-btn {
    background: linear-gradient(135deg, var(--uifc-purple) 0%, #7c3aed 100%);
    color: var(--uifc-white);
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 3px 10px rgba(109, 40, 217, 0.35);
    transition: all var(--uifc-trans);
}

#uifc-upload-btn:hover {
    background: linear-gradient(135deg, var(--uifc-purple-dark) 0%, #5b21b6 100%);
    box-shadow: 0 5px 16px rgba(109, 40, 217, 0.4);
}

#uifc-upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── 8. Custom Radio Pills ───────────────────────────────── */
.uifc-file-direction {
    display: flex;
    justify-content: center; /* Centering radio pills */
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.file-radio {
    flex: 1;
    min-width: 200px;
    max-width: 300px; /* Prevents pills from stretching too wide on large screens */
    cursor: pointer;
}

.file-radio input[type="radio"] { 
    display: none; 
}

.file-radio .radio-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    background: var(--uifc-white);
    border: 2px solid var(--uifc-border);
    border-radius: 10px;
    transition: all var(--uifc-trans);
    user-select: none;
    text-align: left; /* Keeps text inside pill aligned properly */
}

.file-radio .radio-card::before {
    content: "";
    flex-shrink: 0;
    width: 18px; 
    height: 18px;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    background: var(--uifc-white);
    transition: all var(--uifc-trans);
}

.file-radio .radio-card .rc-label {
    display: flex;
    flex-direction: column;
}

.file-radio .radio-card .rc-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--uifc-text);
    line-height: 1.3;
}

.file-radio .radio-card .rc-hint {
    font-size: 11px;
    color: var(--uifc-muted);
    margin-top: 2px;
}

.file-radio .radio-card .rc-icon {
    font-size: 22px;
    line-height: 1;
    margin-right: 2px;
}

/* Radio Checked State */
.file-radio input[type="radio"]:checked + .radio-card {
    border-color: var(--uifc-purple);
    background: var(--uifc-purple-light);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

.file-radio input[type="radio"]:checked + .radio-card::before {
    border-color: var(--uifc-purple);
    background: var(--uifc-purple);
    box-shadow: inset 0 0 0 3px var(--uifc-white);
}

.file-radio input[type="radio"]:checked + .radio-card .rc-title {
    color: var(--uifc-purple-dark);
}

.file-radio input[type="radio"]:not(:checked) + .radio-card:hover {
    border-color: #a78bfa;
    box-shadow: var(--uifc-shadow-sm);
}

/* ── 9. File Input ───────────────────────────────────────── */
.uifc-file-controls {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center; /* Centering file input area */
    gap: 12px;
    flex-wrap: wrap;
}

#uifc-file-input {
    flex: 1;
    min-width: 180px;
    max-width: 400px; /* Control max width for better centered appearance */
    padding: 9px 12px;
    border: 2px dashed var(--uifc-purple);
    border-radius: 8px;
    font-size: 13px;
    color: var(--uifc-muted);
    background: var(--uifc-white);
    cursor: pointer;
    transition: all var(--uifc-trans);
}

#uifc-file-input:hover,
#uifc-file-input:focus {
    outline: none;
    border-color: var(--uifc-purple-dark);
    background: var(--uifc-purple-light);
}

/* ── 10. Loader & Download ───────────────────────────────── */
#uifc-loader {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--uifc-purple-dark);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.uifc-download-btn,
#uifc-download-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 11px 24px;
    background: linear-gradient(135deg, var(--uifc-green) 0%, var(--uifc-green-dark) 100%);
    color: var(--uifc-white);
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(22, 163, 74, 0.35);
    transition: all var(--uifc-trans);
    animation: uifc-pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.uifc-download-btn:hover,
#uifc-download-link a:hover {
    background: linear-gradient(135deg, var(--uifc-green-dark) 0%, #14532d 100%);
    box-shadow: 0 5px 16px rgba(22, 163, 74, 0.45);
    transform: translateY(-1px);
}

@keyframes uifc-pop-in {
    from { opacity: 0; transform: scale(0.85) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.uifc-spin {
    display: inline-block;
    animation: uifc-spin 1s linear infinite;
}

@keyframes uifc-spin { 
    to { transform: rotate(360deg); } 
}

/* ── 11. Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .uifc-editor-modern {
        grid-template-columns: 1fr;
    }
    
    #uifc-top-font-wrap {
        flex-direction: column;
        align-items: stretch;
    }
    
    #uifc-top-font-wrap .uifc-modern-select {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .uifc-file-direction,
    .uifc-file-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .file-radio {
        max-width: 100%;
    }
    
    #uifc-file-input {
        max-width: 100%;
    }

    #uifc-upload-btn {
        width: 100%;
        justify-content: center;
    }
    
    .uifc-text-converter-section::before,
    .uifc-file-upload-modern::before {
        display: none;
    }
    
    .uifc-header {
        padding: 16px 20px;
    }
}
