/* ISO 8573-1 System Sizing Engine - Main Styles */

/* Reset and Base */
.iso-calculator * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.iso-calculator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    max-width: 1200px;
    margin: 30px auto;
    background: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.calculator-header {
    background: linear-gradient(135deg, #0066cc 0%, #0099cc 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.calculator-header h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Body */
.calculator-body {
    padding: 30px;
}

/* Sections */
.input-section,
.iso-section,
.preview-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
}

.input-section h2,
.iso-section h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Input Grid */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #6c757d;
    color: white;
    border-radius: 50%;
    font-size: 0.8em;
    cursor: help;
}

.input-with-unit {
    position: relative;
    display: flex;
}

.input-with-unit input {
    flex: 1;
    padding: 12px 40px 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.input-with-unit input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.unit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 0.9em;
    pointer-events: none;
}

.hint {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 8px;
    font-style: italic;
}

/* ISO Class Grid */
.iso-class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.class-selector {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.class-selector:hover {
    border-color: #0066cc;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.class-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.class-header i {
    color: #0066cc;
    font-size: 1.2em;
}

.class-header span {
    font-weight: 600;
    color: #2c3e50;
}

.class-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #0066cc;
    color: white;
    border-radius: 50%;
    font-weight: 700;
    margin-left: auto;
}

.iso-select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    background: white;
    color: #495057;
    font-size: 0.95em;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.iso-select:focus {
    outline: none;
    border-color: #0066cc;
}

.class-description {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 10px;
    line-height: 1.5;
}

.criticality-selector {
    max-width: 300px;
}

/* Preview Section */
.preview-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px dashed #90caf9;
}

.preview-header h3 {
    color: #1565c0;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.preview-content {
    text-align: center;
}

.class-preview {
    margin-bottom: 20px;
}

.preview-label {
    font-size: 0.9em;
    color: #546e7a;
    margin-bottom: 5px;
}

.preview-value {
    font-size: 3em;
    font-weight: 800;
    color: #0066cc;
    font-family: 'Courier New', monospace;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.application-info {
    font-size: 1.1em;
    color: #2e7d32;
    font-weight: 500;
    padding: 15px;
    background: rgba(46, 125, 50, 0.1);
    border-radius: 8px;
    display: inline-block;
}

/* Action Section */
.action-section {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.calculate-btn,
.reset-btn,
.example-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 200px;
}

.calculate-btn {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    color: white;
}

.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.3);
}

.reset-btn {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
}

.reset-btn:hover {
    background: #e9ecef;
}

.example-btn {
    background: #6c757d;
    color: white;
}

.example-btn:hover {
    background: #5a6268;
}

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Container */
.results-container {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.results-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.results-header h3 {
    color: #2e7d32;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.success-icon {
    color: #2e7d32;
}

.design-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.design-id {
    font-size: 0.9em;
    color: #6c757d;
}

.timestamp {
    font-size: 0.9em;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-card {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: #0066cc;
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.card-icon {
    font-size: 1.5em;
}

.card-header h4 {
    margin: 0;
    font-size: 1.2em;
}

.card-body {
    padding: 20px;
}

.card-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
}

.card-details p {
    margin: 8px 0;
    font-size: 0.9em;
    color: #495057;
}

.card-details strong {
    color: #2c3e50;
}

/* Energy Section */
.energy-section {
    background: #fff8e1;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
    border-left: 4px solid #ffb300;
}

.energy-section h4 {
    color: #e65100;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.energy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.energy-item {
    background: white;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.energy-label {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 10px;
}

.energy-value {
    font-size: 1.5em;
    font-weight: 700;
    color: #2e7d32;
}

/* Specification Section */
.specification-section {
    background: #f3e5f5;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
    border-left: 4px solid #8e24aa;
}

.specification-section h4 {
    color: #6a1b9a;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.spec-item {
    background: white;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.spec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #6a1b9a;
}

.spec-header h5 {
    margin: 0;
    font-size: 1.1em;
}

.spec-item p {
    color: #495057;
    margin-bottom: 10px;
    line-height: 1.5;
}

.spec-detail {
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
}

/* Actions Section */
.actions-section {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 25px;
    border: 2px solid;
    background: white;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 150px;
}

.print-btn {
    border-color: #0066cc;
    color: #0066cc;
}

.print-btn:hover {
    background: #0066cc;
    color: white;
}

.copy-btn {
    border-color: #2e7d32;
    color: #2e7d32;
}

.copy-btn:hover {
    background: #2e7d32;
    color: white;
}

.new-btn {
    border-color: #6c757d;
    color: #6c757d;
}

.new-btn:hover {
    background: #6c757d;
    color: white;
}

/* Footer */
.calculator-footer {
    background: #2c3e50;
    color: white;
    padding: 30px;
    margin-top: 40px;
}

.disclaimer {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.disclaimer p {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    line-height: 1.6;
}

.disclaimer i {
    color: #4fc3f7;
    font-size: 1.2em;
    margin-top: 3px;
}

.credits {
    text-align: center;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.spinner-large {
    font-size: 3em;
    color: #0066cc;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 1.2em;
    color: #2c3e50;
    margin-bottom: 20px;
}

.progress-container {
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0066cc, #0099cc);
    width: 0%;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

/* Dark Theme */
.iso-calculator.theme-dark {
    background: #1a1b1e;
    color: #e9ecef;
}

.iso-calculator.theme-dark .input-section,
.iso-calculator.theme-dark .iso-section,
.iso-calculator.theme-dark .preview-section {
    background: #25262b;
    border-color: #373a40;
}

.iso-calculator.theme-dark .class-selector {
    background: #25262b;
    border-color: #373a40;
}

.iso-calculator.theme-dark .iso-select,
.iso-calculator.theme-dark .input-with-unit input {
    background: #25262b;
    border-color: #373a40;
    color: #e9ecef;
}

.iso-calculator.theme-dark .results-section,
.iso-calculator.theme-dark .result-card,
.iso-calculator.theme-dark .energy-item,
.iso-calculator.theme-dark .spec-item {
    background: #25262b;
    border-color: #373a40;
}

.iso-calculator.theme-dark .action-btn {
    background: #25262b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-header {
        padding: 30px 20px;
    }
    
    .calculator-header h1 {
        font-size: 2em;
    }
    
    .calculator-body {
        padding: 20px;
    }
    
    .input-grid,
    .iso-class-grid,
    .results-grid,
    .energy-grid,
    .spec-grid {
        grid-template-columns: 1fr;
    }
    
    .action-section {
        flex-direction: column;
    }
    
    .calculate-btn,
    .reset-btn,
    .example-btn {
        width: 100%;
    }
    
    .actions-section {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .calculator-header {
        background: white !important;
        color: black !important;
        border-bottom: 2px solid #ccc;
    }
    
    .input-section,
    .iso-section,
    .preview-section,
    .action-section,
    .calculator-footer {
        display: none !important;
    }
    
    .results-section {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
}