/* MixFile Chunked Parser - Modern CSS Styling */

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s ease-in-out;
}

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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="puzzle" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M10,0 Q15,5 10,10 Q5,5 10,0" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23puzzle)"/></svg>') repeat;
    opacity: 0.1;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.header h1 i {
    margin-right: 15px;
    color: #fbbf24;
    animation: pulse 2s infinite;
}

.header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Input Section */
.input-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.input-group label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.input-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    resize: vertical;
    transition: var(--transition);
    background-color: #fafafa;
    min-height: 100px;
}

.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
    background-color: white;
}

.parse-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.parse-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.parse-btn:active {
    transform: translateY(0);
}

.parse-btn i {
    font-size: 1rem;
}

/* Alert Styles */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.alert-success {
    background-color: #d1fae5;
    color: var(--success-color);
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fee2e2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

/* Result Section */
.result-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.info-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    transition: var(--transition);
}

.info-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.info-card h3 {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-card h3 i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.info-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.info-item .label {
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-right: 15px;
    min-width: 100px;
}

.info-item .value {
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
    flex: 1;
}

.info-item .value code {
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9rem;
    border: 1px solid #e2e8f0;
}

.key-value {
    background: #fef3c7 !important;
    border-color: #fed7aa !important;
    color: #92400e !important;
}

.url-break {
    word-break: break-all;
    text-align: left !important;
}

/* Chunk Information */
.chunk-info {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-color: #0284c7;
}

.chunk-info h3 i {
    color: var(--info-color);
}

.chunk-preview {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.chunk-preview h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.chunk-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chunk-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.chunk-index {
    background: var(--info-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.chunk-url {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
}

.chunk-more {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 10px;
}

/* Download Section */
.download-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-color: var(--success-color);
}

.download-card h3 i {
    color: var(--success-color);
}

.download-description {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
}

.download-description p {
    margin: 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.download-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 15px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    text-align: center;
    min-height: 120px;
    justify-content: center;
    font-family: inherit;
}

.download-btn i {
    font-size: 2rem;
    margin-bottom: 5px;
}

.download-btn span {
    font-size: 1rem;
    font-weight: 600;
}

.download-btn small {
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: 400;
    line-height: 1.2;
}

/* Smart download button */
.download-btn.smart-download {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
    border-color: var(--success-color);
}

.download-btn.smart-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #059669, #047857);
}

/* Force download button */
.download-btn.force-download {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border-color: var(--primary-color);
}

.download-btn.force-download:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-dark), #1e40af);
}

/* Info button */
.download-btn.info-btn {
    background: linear-gradient(135deg, var(--warning-color), #d97706);
    color: white;
    border-color: var(--warning-color);
    border: none;
}

.download-btn.info-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* Technical Details */
.technical-details {
    grid-column: 1 / -1;
}

.technical-details .info-item {
    flex-direction: column;
    align-items: stretch;
}

.technical-details .info-item .label {
    margin-bottom: 8px;
}

.technical-details .info-item .value {
    text-align: left;
}

/* Features Section */
.features-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.features-section h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.features-section h3 i {
    color: var(--warning-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.feature-card {
    padding: 20px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.feature-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Example Section */
.example-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.example-section h3 {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.example-section h3 i {
    color: var(--info-color);
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.example-card {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.example-card h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.example-card ul {
    list-style: none;
    padding: 0;
}

.example-card li {
    padding: 8px 0;
    color: var(--text-secondary);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.example-card li:last-child {
    border-bottom: none;
}

.example-card li code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
}

.example-btn {
    background: linear-gradient(135deg, var(--success-color), #059669);
    margin-top: 0;
}

.example-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-color);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading i {
    font-size: 2rem;
    margin-bottom: 10px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 50px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .input-section,
    .result-section,
    .features-section,
    .example-section {
        padding: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .features-grid,
    .example-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .download-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .download-btn {
        min-height: 100px;
        padding: 15px 10px;
    }
    
    .download-btn i {
        font-size: 1.5rem;
    }
    
    .download-btn span {
        font-size: 0.95rem;
    }
    
    .download-btn small {
        font-size: 0.8rem;
    }
    
    .info-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .info-item .label {
        margin-bottom: 5px;
        margin-right: 0;
    }
    
    .info-item .value {
        text-align: left;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .modal-header,
    .modal-body {
        padding: 20px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}