/* Token Estimator Floating Panel */
#token-estimator {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 50;
    padding: 1rem;
    background-color: rgba(30, 41, 59, 0.95);
    /* bg-slate-800/95 */
    backdrop-filter: blur(4px);
    border-radius: 0.5rem;
    border: 1px solid #475569;
    /* border-slate-600 */
    font-size: 0.875rem;
    /* text-sm */
    color: #cbd5e1;
    /* text-slate-300 */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* shadow-xl */
    transition: opacity 0.3s ease;
    min-width: 280px;
    display: none;
    /* Hidden by default */
}

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

#token-estimator .title {
    font-weight: 700;
    color: white;
}

#token-estimator .close-btn {
    color: #94a3b8;
    /* text-slate-400 */
    cursor: pointer;
}

#token-estimator .close-btn:hover {
    color: white;
}

#token-estimator .row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

#token-estimator .divider {
    border-top: 1px solid #475569;
    /* border-slate-600 */
    margin: 0.5rem 0;
}

#token-estimator .text-blue {
    color: #60a5fa;
    font-weight: 700;
}

#token-estimator .text-green {
    color: #4ade80;
    font-weight: 700;
}

#token-estimator .text-white {
    color: white;
    font-weight: 700;
}

/* Hide React App Header */
#root header {
    display: none !important;
}

/* --- HEADLESS UI STYLES --- */

/* Hide Original React App */
#root,
#auth-header,
#token-estimator {
    display: none !important;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    z-index: -9999;
}

/* Custom UI Container */
#custom-ui-container {
    min-height: 100vh;
    background-color: #0B1121;
    color: #e2e8f0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

/* Header */
.c-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(11, 17, 33, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #1e293b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.c-brand {
    display: flex;
    flex-direction: column;
}

.c-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.c-subtitle {
    color: #64748b;
    font-size: 0.75rem;
    margin: 0;
}

/* User Section */
.c-user-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.c-credits-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.c-plan-link {
    color: #94a3b8;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s;
}

.c-plan-link:hover {
    color: #fff;
    text-decoration: underline;
}

.c-logout-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.c-logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ef4444;
}

/* Token Display */
.c-token-display {
    width: 100%;
    max-width: 400px;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #cbd5e1;
}

.c-token-item {
    text-align: center;
}

.c-token-label {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.c-token-value {
    font-weight: 700;
    color: #fff;
}

.c-token-total {
    color: #3b82f6;
}

/* Adjust main container for fixed header */
#custom-ui-container {
    padding-top: 100px;
}

/* Main Grid */
.c-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
    max-width: 1000px;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .c-grid {
        grid-template-columns: 1fr;
    }
}

/* Upload Box */
.c-upload-box {
    background-color: rgba(30, 41, 59, 0.5);
    border: 2px dashed #334155;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.c-upload-box:hover,
.c-upload-box.dragover {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.c-upload-box.has-file {
    border-style: solid;
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
}

.c-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    color: #94a3b8;
}

.c-upload-box.has-file .c-icon {
    color: #10b981;
}

.c-label {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: #f1f5f9;
}

.c-file-name {
    font-size: 0.875rem;
    color: #94a3b8;
    word-break: break-all;
}

/* Controls Section */
.c-controls {
    width: 100%;
    max-width: 800px;
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
}

.c-control-group {
    margin-bottom: 1.5rem;
}

.c-control-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Slider */
.c-slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.c-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    background: #475569;
    border-radius: 3px;
    outline: none;
}

.c-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.c-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.c-slider-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #3b82f6;
    min-width: 80px;
    text-align: right;
}

/* Focus Input */
.c-textarea {
    width: 100%;
    background-color: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 1rem;
    color: white;
    font-size: 0.9rem;
    min-height: 100px;
    resize: vertical;
    transition: border-color 0.2s;
}

.c-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Generate Button */
.c-generate-btn {
    width: 100%;
    max-width: 400px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.c-generate-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.c-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Status */
.c-status {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #94a3b8;
    min-height: 1.5rem;
}