/* Stock Cyclicity Analyzer - Stylesheet */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #333;
}

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

/* Cards */
.card {
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.card-header {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
}

.card-header.bg-gradient {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%) !important;
}

/* Input Section */
.input-group-lg .form-control {
    border-radius: 0.5rem;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.input-group-lg .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.input-group-lg .btn {
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.input-group-lg .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

/* Form Controls */
.form-check-input {
    width: 1.25em;
    height: 1.25em;
    border-radius: 0.25em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Statistics Boxes */
.stat-box {
    padding: 1.5rem;
    border-radius: 0.5rem;
    background-color: var(--light-bg);
    transition: all 0.3s ease;
}

.stat-box:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

.stat-box h4 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
}

/* List Groups */
.list-group-item {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.list-group-item:hover {
    background-color: var(--light-bg);
    transform: translateX(4px);
}

.list-group-item.best-month {
    border-left: 4px solid var(--success-color);
}

.list-group-item.worst-month {
    border-left: 4px solid var(--danger-color);
}

.list-group-item strong {
    color: var(--primary-color);
}

/* Images */
.img-fluid {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Pre/Code Blocks */
pre {
    background-color: #2d2d2d !important;
    color: #f8f8f2 !important;
    border-radius: 0.5rem !important;
    padding: 1rem !important;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-x: auto;
}

pre::-webkit-scrollbar {
    height: 6px;
}

pre::-webkit-scrollbar-track {
    background: #f1f1f1;
}

pre::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Detailed Report override: ensure report text is readable even when Bootstrap's
   bg-light class is present on the <pre> element. This targets the specific
   report element by id and forces a dark background with light text for
   accessibility and contrast. */
#reportText {
    background-color: #2d2d2d !important;
    color: #f8f8f2 !important;
    white-space: pre-wrap; /* allow wrapping for narrow screens */
    word-break: break-word;
}

/* Alerts */
.alert {
    border-radius: 0.5rem;
    border: none;
    box-shadow: var(--shadow);
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-danger .btn-close {
    filter: invert(1) opacity(0.5);
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0a58ca 0%, #084298 100%);
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.3);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #157347 0%, #0f5132 100%);
    box-shadow: 0 6px 16px rgba(25, 135, 84, 0.3);
    transform: translateY(-2px);
}

.btn-outline-secondary {
    border: 2px solid #6c757d;
    color: #6c757d;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading Spinner */
.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Utility Classes */
.hide {
    display: none !important;
}

.show {
    display: block !important;
}

.bg-gradient {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .navbar-text {
        display: none;
    }

    .stat-box {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    pre {
        font-size: 0.8rem;
        max-height: 400px;
    }

    .btn-lg {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }

    .input-group-lg .form-control,
    .input-group-lg .btn {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.1rem;
    }

    .stat-box h4 {
        font-size: 1.25rem;
    }

    .list-group-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Animation Classes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-down {
    animation: slideDown 0.3s ease-in-out;
}

/* Footer */
footer {
    margin-top: auto;
    background-color: var(--light-bg);
}

footer small {
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    footer {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    body {
        background-color: white;
    }
}
