/**
 * Ultimate Utility Hub - Phase 1
 * Modern Glassmorphism UI Stylesheet
 */

:root {
    --uuh-primary: #6366f1;
    --uuh-primary-dark: #4f46e5;
    --uuh-secondary: #ec4899;
    --uuh-success: #10b981;
    --uuh-warning: #f59e0b;
    --uuh-error: #ef4444;
    --uuh-bg-dark: #0f172a;
    --uuh-bg-card: rgba(30, 41, 59, 0.75);
    --uuh-text: #f8fafc;
    --uuh-text-muted: #94a3b8;
    --uuh-border: rgba(148, 163, 184, 0.15);
    --uuh-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --uuh-glow: 0 0 60px rgba(99, 102, 241, 0.25);
    --uuh-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container */
.uuh-tool-container {
    max-width: 800px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Card */
.uuh-tool-card {
    background: var(--uuh-bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--uuh-border);
    border-radius: 28px;
    padding: 2.5rem;
    box-shadow: var(--uuh-shadow), var(--uuh-glow);
    position: relative;
    overflow: hidden;
}

.uuh-tool-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);
    pointer-events: none;
    animation: uuh-float 10s ease-in-out infinite;
}

@keyframes uuh-float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(20px, -20px) rotate(2deg); }
    66% { transform: translate(-10px, 10px) rotate(-2deg); }
}

/* Header */
.uuh-tool-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 1;
}

.uuh-tool-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto 1.5rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4);
    animation: uuh-pulse 3s ease-in-out infinite;
}

@keyframes uuh-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.uuh-tool-icon svg {
    width: 42px;
    height: 42px;
    stroke: white;
}

/* Icon colors per tool */
.uuh-icon-csv { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.uuh-icon-url { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.uuh-icon-invoice { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.uuh-icon-image { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.uuh-icon-base64 { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.uuh-icon-json { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }
.uuh-icon-loan { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.uuh-icon-password { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.uuh-icon-color { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.uuh-icon-pdf { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

.uuh-tool-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--uuh-text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.uuh-tool-subtitle {
    color: var(--uuh-text-muted);
    font-size: 1rem;
}

/* Form Elements */
.uuh-tool-form {
    position: relative;
    z-index: 1;
}

.uuh-form-group {
    margin-bottom: 1.5rem;
}

.uuh-form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.uuh-form-half { flex: 0 0 calc(50% - 0.5rem); }
.uuh-form-third { flex: 0 0 calc(33.333% - 0.667rem); }

.uuh-label {
    display: block;
    color: var(--uuh-text);
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.uuh-input,
.uuh-textarea,
.uuh-select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 2px solid var(--uuh-border);
    border-radius: 12px;
    color: var(--uuh-text);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--uuh-transition);
    outline: none;
}

.uuh-input:focus,
.uuh-textarea:focus,
.uuh-select:focus {
    border-color: var(--uuh-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.uuh-textarea {
    resize: vertical;
    min-height: 120px;
}

.uuh-textarea-code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9rem;
}

.uuh-input::placeholder,
.uuh-textarea::placeholder {
    color: var(--uuh-text-muted);
}

.uuh-input-small {
    width: 80px;
}

/* Radio Buttons */
.uuh-radio-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.uuh-radio {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    position: relative;
}

.uuh-radio input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.uuh-radio-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--uuh-border);
    border-radius: 50%;
    position: relative;
    transition: var(--uuh-transition);
    background: rgba(15, 23, 42, 0.4);
}

.uuh-radio input:checked + .uuh-radio-custom {
    border-color: var(--uuh-primary);
    background: var(--uuh-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.uuh-radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.uuh-radio input:checked + .uuh-radio-custom::after {
    transform: translate(-50%, -50%) scale(1);
}

.uuh-radio span:last-child {
    color: var(--uuh-text);
    font-weight: 500;
}

/* File Upload */
.uuh-file-upload {
    position: relative;
}

.uuh-file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.uuh-file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.4);
    border: 2px dashed var(--uuh-border);
    border-radius: 16px;
    text-align: center;
    transition: var(--uuh-transition);
    cursor: pointer;
}

.uuh-file-label:hover {
    border-color: var(--uuh-primary);
    background: rgba(99, 102, 241, 0.1);
}

.uuh-file-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.uuh-file-text {
    color: var(--uuh-text);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.uuh-file-types {
    color: var(--uuh-text-muted);
    font-size: 0.875rem;
}

/* Buttons */
.uuh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--uuh-transition);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.uuh-btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--uuh-primary) 0%, var(--uuh-primary-dark) 100%);
    color: white;
    box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.5);
}

.uuh-btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

.uuh-btn-primary:hover::before {
    left: 100%;
}

.uuh-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.6);
}

.uuh-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--uuh-text);
    border: 1px solid var(--uuh-border);
}

.uuh-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--uuh-primary);
}

.uuh-btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.uuh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.uuh-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: uuh-spin 0.8s linear infinite;
}

.uuh-btn.loading .uuh-btn-text {
    display: none;
}

.uuh-btn.loading .uuh-spinner {
    display: block;
}

@keyframes uuh-spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.uuh-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fecaca;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-top: 1rem;
    display: none;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    animation: uuh-shake 0.5s ease;
}

.uuh-error.show {
    display: block;
}

@keyframes uuh-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

/* Results */
.uuh-results {
    margin-top: 1.5rem;
    display: none;
    position: relative;
    z-index: 1;
}

.uuh-results.show {
    display: block;
    animation: uuh-slideUp 0.5s ease;
}

@keyframes uuh-slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Result Cards */
.uuh-result-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--uuh-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.uuh-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--uuh-border);
}

.uuh-result-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--uuh-text);
}

/* Tables */
.uuh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.uuh-table th {
    text-align: left;
    padding: 0.75rem;
    color: var(--uuh-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--uuh-border);
}

.uuh-table td {
    padding: 0.75rem;
    color: var(--uuh-text);
    border-bottom: 1px solid var(--uuh-border);
}

.uuh-table tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.uuh-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.uuh-badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.uuh-badge-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.uuh-badge-error { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* Color palette display */
.uuh-color-palette {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.uuh-color-swatch {
    width: 80px;
    height: 100px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.75rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.uuh-color-swatch:hover {
    transform: translateY(-5px) scale(1.05);
}

.uuh-color-hex {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(0,0,0,0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    backdrop-filter: blur(10px);
}

/* Password strength meter */
.uuh-strength-meter {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.uuh-strength-bar {
    height: 100%;
    border-radius: 4px;
    transition: all 0.5s ease;
    width: 0;
}

/* Invoice items */
.uuh-invoice-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.uuh-invoice-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.uuh-invoice-item input:first-child {
    flex: 1;
}

/* Password input wrapper */
.uuh-password-input-wrapper {
    position: relative;
}

.uuh-password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--uuh-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uuh-password-toggle:hover {
    color: var(--uuh-text);
}

.uuh-password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Copy button */
.uuh-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #34d399;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--uuh-transition);
}

.uuh-copy-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.uuh-copy-btn.copied {
    background: rgba(16, 185, 129, 0.3);
}

/* Output textarea */
.uuh-output-textarea {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
    font-family: 'SF Mono', Monaco, monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .uuh-tool-card {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .uuh-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .uuh-form-half,
    .uuh-form-third {
        flex: 1;
    }
    
    .uuh-tool-title {
        font-size: 1.5rem;
    }
    
    .uuh-radio-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .uuh-invoice-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .uuh-invoice-item input.uuh-input-small {
        width: 100%;
    }
    
    .uuh-color-palette {
        justify-content: center;
    }
}

/* Light mode support */
@media (prefers-color-scheme: light) {
    :root {
        --uuh-bg-dark: #f8fafc;
        --uuh-bg-card: rgba(255, 255, 255, 0.9);
        --uuh-text: #0f172a;
        --uuh-text-muted: #64748b;
        --uuh-border: rgba(148, 163, 184, 0.3);
        --uuh-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    }
    
    .uuh-input,
    .uuh-textarea,
    .uuh-select {
        background: rgba(241, 245, 249, 0.8);
        color: var(--uuh-text);
    }
    
    .uuh-result-card {
        background: rgba(241, 245, 249, 0.6);
    }
    
    .uuh-error {
        background: rgba(239, 68, 68, 0.05);
        color: #dc2626;
    }
}