/* OARC Fractal Generator Styles */

/* Global Styles */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.container {
    max-width: 1400px;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Section Spacing */
.operation-section {
    margin: 3rem 0;
    padding: 2rem 0;
    border-bottom: 1px solid #e9ecef;
}

.operation-section:last-child {
    border-bottom: none;
}

/* Cards */
.demo-card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid #dee2e6;
    transition: box-shadow 0.15s ease-in-out;
}

.demo-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Results Display */
.code-block {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.code-block.result-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.code-block.result-error {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.friendly-result {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    min-height: 100px;
    max-height: 500px;
    overflow-y: auto;
}

.friendly-result.success {
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.friendly-result.error {
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.result-details {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
    line-height: 1.5;
}

/* Fractal Canvas Styles */
.fractal-canvas-container {
    margin: 1rem 0;
    text-align: center;
    background-color: #000;
    border-radius: 0.375rem;
    padding: 0.5rem;
    display: inline-block;
}

.fractal-canvas-container canvas {
    border-radius: 0.25rem;
    max-width: 100%;
    height: auto;
    display: block;
}

/* Multi-fractal Grid */
.multi-fractal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.fractal-grid-item {
    text-align: center;
    background-color: #000;
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.fractal-grid-item canvas {
    border-radius: 0.25rem;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.fractal-label {
    color: #fff;
    font-size: 0.75rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Animation Container */
.animation-container {
    text-align: center;
    margin: 1rem 0;
}

.animation-container canvas {
    background-color: #000;
    border-radius: 0.375rem;
    max-width: 100%;
    height: auto;
}

.animation-controls {
    max-width: 400px;
    margin: 0 auto;
}

/* Form Controls */
.form-range {
    margin: 0.5rem 0;
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #000;
}

.btn-info {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
    color: #000;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* Loading States */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Progress Bars */
.progress {
    background-color: #e9ecef;
    border-radius: 0.375rem;
}

.progress-bar {
    background-color: #0d6efd;
    transition: width 0.3s ease;
}

/* Alerts */
.alert {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

.alert-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Footer */
.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    margin-top: 4rem;
    padding: 3rem 0 2rem;
    color: #6c757d;
}

.footer h5, .footer h6 {
    color: #495057;
    font-weight: 600;
}

.footer .list-unstyled li {
    margin-bottom: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .operation-section {
        margin: 2rem 0;
        padding: 1rem 0;
    }
    
    .multi-fractal-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.5rem;
    }
    
    .fractal-canvas-container {
        padding: 0.25rem;
    }
    
    .code-block {
        font-size: 0.75rem;
        max-height: 300px;
    }
    
    .friendly-result {
        max-height: 400px;
    }
    
    .result-icon {
        font-size: 1.25rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-text {
        display: none;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .multi-fractal-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .animation-container canvas {
        max-width: 280px;
    }
}

/* Custom Scrollbars */
.code-block::-webkit-scrollbar,
.friendly-result::-webkit-scrollbar {
    width: 8px;
}

.code-block::-webkit-scrollbar-track,
.friendly-result::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-thumb,
.friendly-result::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-thumb:hover,
.friendly-result::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fractal-canvas-container,
.multi-fractal-grid,
.animation-container {
    animation: fadeIn 0.5s ease-in-out;
}

/* Hover Effects */
.fractal-grid-item:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease-in-out;
}

.animation-container canvas:hover {
    box-shadow: 0 0 20px rgba(13, 110, 253, 0.3);
    transition: box-shadow 0.3s ease-in-out;
}

/* Focus States */
.form-control:focus,
.form-select:focus,
.form-range:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .alert {
        display: none !important;
    }
    
    .fractal-canvas-container,
    .multi-fractal-grid,
    .animation-container {
        break-inside: avoid;
    }
    
    .code-block,
    .friendly-result {
        max-height: none;
        overflow: visible;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .code-block {
        border-width: 2px;
    }
    
    .friendly-result {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .btn:hover {
        transform: none;
    }
    
    .fractal-grid-item:hover {
        transform: none;
    }
    
    .animation-container canvas:hover {
        transition: none;
    }
    
    .fractal-canvas-container,
    .multi-fractal-grid,
    .animation-container {
        animation: none;
    }
}

/* Saved fractals section styles */
#saved-fractals-dropdown {
    font-family: monospace;
}

#saved-fractals-status {
    min-height: 24px;
}

#saved-fractals-status .text-success {
    color: #198754 !important;
}

#saved-fractals-status .text-danger {
    color: #dc3545 !important;
}

#saved-fractals-status .text-warning {
    color: #ffc107 !important;
}

#saved-fractals-status .text-info {
    color: #0dcaf0 !important;
}

#saved-fractals-status .text-muted {
    color: #6c757d !important;
}

#load-fractal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modal fractal display styles */
.modal-fractal-container {
    text-align: center;
}

.modal-fractal-container .fractal-canvas-container {
    display: inline-block;
    margin: 0 auto;
    max-width: 100%;
}

.modal-fractal-container canvas {
    max-width: 100%;
    height: auto;
}

.modal-fractal-container .multi-fractal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

#modal-fractal-info {
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Modal responsive adjustments */
@media (max-width: 768px) {
    .modal-dialog.modal-xl {
        max-width: 95%;
        margin: 1rem auto;
    }
    
    .modal-fractal-container .multi-fractal-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.5rem;
    }
    
    #modal-fractal-info {
        font-size: 0.75rem;
    }
}