/**
 * OpsToolKit - Custom Styles
 *
 * Bootstrap 5 customizations with government-inspired design
 * Per plan.md: Clean, professional interface with default Bootstrap palette
 */

/* =========================================================================
   Global Styles
   ========================================================================= */

:root {
    /* Extend Bootstrap primary color for consistency */
    --bs-primary: #0d6efd;
    --bs-primary-rgb: 13, 110, 253;

    /* Custom colors */
    --ops-dark-blue: #1e3a8a;
    --ops-light-gray: #f8f9fa;
    --ops-border-gray: #dee2e6;

    /* Loading overlay */
    --loading-overlay-bg: rgba(0, 0, 0, 0.7);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

main {
    flex: 1;
}

/* =========================================================================
   Navigation Customizations
   ========================================================================= */

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

.navbar-dark .navbar-nav .nav-link {
    transition: opacity 0.2s;
}

.navbar-dark .navbar-nav .nav-link:hover {
    opacity: 0.8;
}

/* Session timer styling */
#session-timer {
    font-size: 0.85rem;
    display: block;
    padding: 0.25rem 0;
}

/* =========================================================================
   Flash Messages Enhancement
   ========================================================================= */

.alert {
    border-left: 4px solid;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    border-left-color: #198754;
}

.alert-danger {
    border-left-color: #dc3545;
}

.alert-warning {
    border-left-color: #ffc107;
}

.alert-info {
    border-left-color: #0dcaf0;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =========================================================================
   Loading Overlay (T041)
   ========================================================================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loading-overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading-overlay.d-none {
    display: none !important;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

#loading-message {
    font-size: 1.1rem;
    font-weight: 500;
}

/* =========================================================================
   Progress Indicators (T042)
   ========================================================================= */

.progress-container {
    margin: 1.5rem 0;
}

.progress {
    height: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    transition: width 0.3s ease;
    font-weight: 600;
}

/* Animated progress bar for indeterminate operations */
.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

/* =========================================================================
   Tool Cards (for landing page)
   ========================================================================= */

.tool-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--ops-border-gray);
    border-radius: 0.5rem;
    height: 100%;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.tool-card .card-header {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--ops-dark-blue) 100%);
    color: white;
    font-weight: 600;
    border-radius: 0.5rem 0.5rem 0 0;
}

.tool-card .card-body {
    padding: 1.5rem;
}

.tool-card .btn {
    width: 100%;
    font-weight: 600;
}

.tool-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    text-align: center;
}

/* =========================================================================
   Performance Warning Banner
   ========================================================================= */

.performance-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #000;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #ff6f00;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.9;
    }
}

.performance-warning i {
    font-size: 1.5rem;
    vertical-align: middle;
}

/* =========================================================================
   Forms Enhancement
   ========================================================================= */

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.form-label {
    font-weight: 600;
    color: #495057;
}

/* File upload styling */
.file-upload-area {
    border: 2px dashed var(--ops-border-gray);
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    background: var(--ops-light-gray);
    transition: all 0.3s;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
}

.file-upload-area.dragover {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.1);
    transform: scale(1.02);
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--bs-primary);
    margin-bottom: 1rem;
}

/* =========================================================================
   Buttons Enhancement
   ========================================================================= */

.btn {
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--ops-dark-blue) 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(var(--bs-primary-rgb), 0.3);
}

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

/* =========================================================================
   Tables Enhancement
   ========================================================================= */

.table-responsive {
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.table thead th {
    background-color: var(--ops-light-gray);
    border-bottom: 2px solid var(--ops-border-gray);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

/* =========================================================================
   Footer
   ========================================================================= */

.footer {
    margin-top: auto;
    border-top: 1px solid var(--ops-border-gray);
}

.footer a {
    color: #6c757d;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--bs-primary);
}

/* =========================================================================
   Utility Classes
   ========================================================================= */

/* Loading state for buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: spinner-border 0.75s linear infinite;
}

/* Status badges */
.badge-status {
    padding: 0.5em 0.75em;
    font-weight: 600;
    border-radius: 0.375rem;
}

/* Code blocks */
.code-block {
    background: #f8f9fa;
    border: 1px solid var(--ops-border-gray);
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* =========================================================================
   Responsive Adjustments
   ========================================================================= */

@media (max-width: 768px) {
    .tool-card {
        margin-bottom: 1rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .performance-warning {
        font-size: 0.9rem;
    }
}

/* =========================================================================
   Print Styles
   ========================================================================= */

@media print {
    .navbar,
    .footer,
    .btn,
    .alert {
        display: none !important;
    }

    body {
        background: white;
    }

    .card {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}
