/* EmulatorJS ROM Patcher Styles */
/* File: assets/css/ejs-rom-patcher.css */

.ejs-rom-patcher-container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
    overflow: hidden;
}

.ejs-rom-patcher-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #007cba, #00a0d2, #0073aa);
}

/* Header Styles */
.ejs-patcher-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f1;
}

.ejs-patcher-title {
    color: #1e1e1e;
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ejs-patcher-title i {
    color: #007cba;
    font-size: 32px;
}

.ejs-patcher-description {
    color: #646970;
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

/* Statistics Section */
.ejs-patcher-stats {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
}

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

.ejs-stat-item {
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e1e5e9;
}

.ejs-stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #007cba;
    margin-bottom: 5px;
}

.ejs-stat-label {
    font-size: 14px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* File Input Section */
.ejs-file-input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.ejs-input-group {
    position: relative;
}

.ejs-input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #1e1e1e;
    font-size: 16px;
}

.ejs-input-label i {
    color: #007cba;
    font-size: 18px;
}

.ejs-file-input {
    width: 100%;
    padding: 20px;
    border: 2px dashed #c3c4c7;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #646970;
}

.ejs-file-input:hover {
    border-color: #007cba;
    background: #f6f7f7;
}

.ejs-file-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.ejs-file-info {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    font-size: 14px;
    min-height: 40px;
}

.ejs-file-info:empty {
    display: none;
}

.ejs-file-details {
    margin-bottom: 10px;
}

.ejs-file-name {
    font-weight: 600;
    color: #1e1e1e;
    margin-bottom: 5px;
}

.ejs-file-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ejs-file-size, .ejs-file-type {
    padding: 2px 8px;
    background: #007cba;
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.ejs-file-type {
    background: #00a32a;
}

.ejs-file-analysis {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e1e5e9;
}

.ejs-checksum, .ejs-header-info {
    margin: 5px 0;
    font-size: 13px;
}

.ejs-checksum code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
}

.ejs-file-preview {
    margin-top: 10px;
}

.ejs-hex-preview {
    background: #2d3748;
    color: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.ejs-preview-header {
    background: #4a5568;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ejs-hex-data {
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    word-break: break-all;
}

/* Options Section */
.ejs-patcher-options {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid #e1e5e9;
}

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

.ejs-option-group {
    display: flex;
    flex-direction: column;
}

.ejs-option-group label {
    font-weight: 600;
    color: #1e1e1e;
    margin-bottom: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ejs-select {
    padding: 10px 12px;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #1e1e1e;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.ejs-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.ejs-option-description {
    margin-top: 5px;
    color: #646970;
    font-size: 12px;
    line-height: 1.4;
}

/* Action Buttons */
.ejs-patcher-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

.ejs-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.ejs-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.ejs-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ejs-btn-primary {
    background: linear-gradient(135deg, #007cba, #005a87);
    color: white;
}

.ejs-btn-primary:not(:disabled):hover {
    background: linear-gradient(135deg, #005a87, #004066);
}

.ejs-btn-success {
    background: linear-gradient(135deg, #00a32a, #007d1f);
    color: white;
}

.ejs-btn-success:not(:disabled):hover {
    background: linear-gradient(135deg, #007d1f, #005d17);
}

.ejs-btn-secondary {
    background: linear-gradient(135deg, #646970, #50575e);
    color: white;
}

.ejs-btn-secondary:not(:disabled):hover {
    background: linear-gradient(135deg, #50575e, #3c434a);
}

.ejs-btn-info {
    background: linear-gradient(135deg, #72aee6, #2271b1);
    color: white;
}

.ejs-btn-info:not(:disabled):hover {
    background: linear-gradient(135deg, #2271b1, #135e96);
}

.ejs-btn i {
    font-size: 16px;
}

/* Progress Section */
.ejs-progress-container {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.ejs-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ejs-progress-title {
    font-weight: 600;
    color: #1e1e1e;
    font-size: 16px;
}

.ejs-progress-percentage {
    font-weight: 700;
    color: #007cba;
    font-size: 18px;
}

.ejs-progress-bar {
    width: 100%;
    height: 12px;
    background: #f0f0f1;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.ejs-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #00a0d2);
    border-radius: 6px;
    transition: width 0.4s ease;
    width: 0%;
    position: relative;
    overflow: hidden;
}

.ejs-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.ejs-progress-details {
    text-align: center;
    font-size: 14px;
    color: #646970;
}

/* Status Messages */
.ejs-status-container {
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
}

.ejs-status-info {
    background: #e7f3ff;
    color: #0073aa;
    border: 1px solid #72aee6;
}

.ejs-status-success {
    background: #e6ffed;
    color: #00a32a;
    border: 1px solid #00a32a;
}

.ejs-status-error {
    background: #ffe6e6;
    color: #d63638;
    border: 1px solid #d63638;
}

.ejs-status-warning {
    background: #fff8e1;
    color: #b32d2e;
    border: 1px solid #dba617;
}

.ejs-status-message {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ejs-status-message i {
    font-size: 18px;
}

/* ROM Analysis Display */
.ejs-rom-analysis {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.ejs-analysis-title {
    color: #1e1e1e;
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ejs-analysis-title i {
    color: #007cba;
    font-size: 22px;
}

.ejs-analysis-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f1;
}

.ejs-analysis-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ejs-analysis-section h4 {
    color: #1e1e1e;
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.ejs-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.ejs-analysis-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
}

.ejs-analysis-item label {
    font-weight: 600;
    color: #646970;
    font-size: 14px;
}

.ejs-analysis-item span {
    color: #1e1e1e;
    font-size: 14px;
}

.ejs-checksum {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e1e5e9;
    word-break: break-all;
}

.ejs-header-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* Patch Database Section */
.ejs-patch-database {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.ejs-database-title {
    color: #1e1e1e;
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ejs-database-title i {
    color: #007cba;
    font-size: 22px;
}

.ejs-patches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.ejs-patch-item {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.ejs-patch-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: white;
}

.ejs-patch-title {
    margin: 0 0 10px 0;
    color: #1e1e1e;
    font-size: 16px;
    font-weight: 600;
}

.ejs-patch-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.ejs-patch-format, .ejs-patch-type {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ejs-patch-format {
    background: #007cba;
    color: white;
}

.ejs-patch-type {
    background: #00a32a;
    color: white;
}

.ejs-patch-description {
    color: #646970;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.ejs-patch-actions {
    display: flex;
    gap: 10px;
}

.ejs-btn-small {
    padding: 8px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ejs-patch-checksum {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e1e5e9;
}

.ejs-patch-checksum small {
    color: #646970;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
}

/* Help Section */
.ejs-patcher-help {
    margin-top: 30px;
}

.ejs-help-details {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.ejs-help-summary {
    background: #f8f9fa;
    padding: 15px 20px;
    cursor: pointer;
    font-weight: 600;
    color: #1e1e1e;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s ease;
}

.ejs-help-summary:hover {
    background: #f0f0f1;
}

.ejs-help-summary i {
    color: #007cba;
    font-size: 18px;
}

.ejs-help-content {
    padding: 20px;
    background: white;
}

.ejs-help-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.ejs-help-section h4 {
    color: #1e1e1e;
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.ejs-help-list, .ejs-help-steps {
    margin: 0;
    padding-left: 20px;
}

.ejs-help-list li, .ejs-help-steps li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.ejs-help-list li strong {
    color: #007cba;
}

/* Drag and Drop */
.ejs-rom-patcher-container.ejs-drag-hover {
    border: 2px dashed #007cba;
    background: rgba(0, 124, 186, 0.05);
}

.ejs-rom-patcher-container.ejs-drag-hover::after {
    content: "📁 Drop ROM or patch files here";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 124, 186, 0.95);
    color: white;
    padding: 20px 40px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 18px;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Theme Variants */
.ejs-rom-patcher-theme-dark {
    background: #1e1e1e;
    color: #e2e8f0;
}

.ejs-rom-patcher-theme-dark .ejs-patcher-header {
    border-bottom-color: #2d3748;
}

.ejs-rom-patcher-theme-dark .ejs-patcher-title {
    color: #e2e8f0;
}

.ejs-rom-patcher-theme-dark .ejs-patcher-description {
    color: #a0aec0;
}

.ejs-rom-patcher-theme-dark .ejs-patcher-stats,
.ejs-rom-patcher-theme-dark .ejs-patcher-options,
.ejs-rom-patcher-theme-dark .ejs-progress-container,
.ejs-rom-patcher-theme-dark .ejs-rom-analysis,
.ejs-rom-patcher-theme-dark .ejs-patch-database {
    background: #2d3748;
    border-color: #4a5568;
}

.ejs-rom-patcher-theme-dark .ejs-stat-item,
.ejs-rom-patcher-theme-dark .ejs-file-input,
.ejs-rom-patcher-theme-dark .ejs-select {
    background: #1e1e1e;
    border-color: #4a5568;
    color: #e2e8f0;
}

.ejs-rom-patcher-theme-dark .ejs-file-info {
    background: #1e1e1e;
    border-color: #4a5568;
}

.ejs-rom-patcher-theme-retro {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: 3px solid #4a4a4a;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.ejs-rom-patcher-theme-retro .ejs-patcher-title {
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-family: "Courier New", monospace;
}

.ejs-rom-patcher-theme-retro .ejs-patcher-stats,
.ejs-rom-patcher-theme-retro .ejs-patcher-options,
.ejs-rom-patcher-theme-retro .ejs-progress-container,
.ejs-rom-patcher-theme-retro .ejs-rom-analysis,
.ejs-rom-patcher-theme-retro .ejs-patch-database {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.ejs-rom-patcher-theme-retro .ejs-btn {
    border: 2px solid #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: "Courier New", monospace;
}

.ejs-rom-patcher-theme-retro .ejs-progress-fill {
    background: linear-gradient(90deg, #ff6b6b, #feca57);
}

/* Responsive Design */
@media (max-width: 768px) {
    .ejs-rom-patcher-container {
        margin: 10px;
        padding: 15px;
    }
    
    .ejs-file-input-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ejs-options-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ejs-patcher-actions {
        flex-direction: column;
    }
    
    .ejs-btn {
        width: 100%;
        justify-content: center;
    }
    
    .ejs-analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .ejs-analysis-item {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .ejs-analysis-item label {
        font-weight: 700;
    }
    
    .ejs-patches-grid {
        grid-template-columns: 1fr;
    }
    
    .ejs-help-sections {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ejs-rom-patcher-container {
        margin: 5px;
        padding: 10px;
    }
    
    .ejs-patcher-title {
        font-size: 24px;
    }
    
    .ejs-patcher-header {
        padding: 15px 0;
    }
    
    .ejs-stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    .ejs-rom-patcher-container {
        border: 2px solid #000;
    }
    
    .ejs-btn {
        border: 2px solid currentColor;
    }
}

/* Loading States */
.ejs-loading {
    opacity: 0.7;
    pointer-events: none;
}

.ejs-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid #007cba;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}