/* ========================================
   IOC Analyzer - Custom CSS
   Cybersecurity-themed professional interface
   ======================================== */

/* CSS Custom Properties - Dark Theme */
:root {
    /* Primary Colors - Opticore Theme */
    --primary: 0 123 255; /* #007bff - Bright blue */
    --primary-dark: 0 86 179; /* #0056b3 */
    --primary-light: 102 179 255; /* #66b3ff */
    
    /* Security-themed Colors */
    --danger: 255 77 77; /* #ff4d4d */
    --warning: 255 206 84; /* #ffce54 */
    --success: 72 207 173; /* #48cfad */
    --info: 116 185 255; /* #74b9ff */
    
    /* Dark Theme Grayscale */
    --dark: 15 23 42; /* #0f172a - Very dark blue */
    --light: 30 41 59; /* #1e293b - Dark slate */
    --gray-100: 30 41 59; /* #1e293b */
    --gray-200: 51 65 85; /* #334155 */
    --gray-300: 71 85 105; /* #475569 */
    --gray-400: 100 116 139; /* #64748b */
    --gray-500: 148 163 184; /* #94a3b8 */
    --gray-600: 203 213 225; /* #cbd5e1 */
    --gray-700: 226 232 240; /* #e2e8f0 */
    --gray-800: 241 245 249; /* #f1f5f9 */
    --gray-900: 248 250 252; /* #f8fafc */
    
    /* Cyber Security Theme */
    --cyber-blue: 0 255 255; /* #00ffff */
    --cyber-green: 0 255 0; /* #00ff00 */
    --cyber-red: 255 0 102; /* #ff0066 */
    --cyber-purple: 153 50 204; /* #9932cc */
    
    /* Background Gradients - Dark Theme */
    --bg-gradient-primary: linear-gradient(135deg, rgb(var(--primary)) 0%, rgb(var(--primary-dark)) 100%);
    --bg-gradient-danger: linear-gradient(135deg, rgb(var(--danger)) 0%, #e74c3c 100%);
    --bg-gradient-success: linear-gradient(135deg, rgb(var(--success)) 0%, #27ae60 100%);
    --bg-gradient-cyber: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --bg-gradient-dark: linear-gradient(135deg, rgb(var(--dark)) 0%, rgb(var(--light)) 100%);
    
    /* Shadows */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --shadow-cyber: 0 0 20px rgba(0, 255, 255, 0.3);
    
    /* Transitions */
    --transition-base: all 0.3s ease;
    --transition-fast: all 0.15s ease;
    --transition-slow: all 0.5s ease;
}

/* ========================================
   Base Styles
   ======================================== */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: rgb(var(--gray-700));
    background: var(--bg-gradient-dark);
    min-height: 100vh;
}

/* ========================================
   Navigation Enhancements
   ======================================== */

.navbar {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 123, 255, 0.3);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    color: rgb(var(--gray-700)) !important;
}

.navbar-brand img {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.navbar-nav .nav-link:hover {
    transform: translateY(-1px);
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: rgba(255,255,255,0.8);
    border-radius: 2px;
}

/* ========================================
   Cards and Components
   ======================================== */

.card {
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    color: rgb(var(--gray-700));
}

.card:hover {
    box-shadow: 0 8px 32px rgba(0, 123, 255, 0.3);
    transform: translateY(-2px);
    border-color: rgba(0, 123, 255, 0.5);
}

.card-header {
    border-radius: 15px 15px 0 0 !important;
    background: var(--bg-gradient-cyber);
    color: rgb(var(--gray-700));
    border: none;
    border-bottom: 1px solid rgba(0, 123, 255, 0.2);
}

/* Background Gradients */
.bg-gradient-primary {
    background: var(--bg-gradient-primary) !important;
}

.bg-gradient-danger {
    background: var(--bg-gradient-danger) !important;
}

.bg-gradient-success {
    background: var(--bg-gradient-success) !important;
}

/* ========================================
   Hero Section
   ======================================== */

.hero-section {
    position: relative;
    padding: 4rem 0;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="%23e9ecef" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.5;
    pointer-events: none;
}

.hero-section .display-4 {
    text-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background: var(--bg-gradient-cyber);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   IOC Input Form
   ======================================== */

.input-group-lg .form-control {
    border-radius: 15px 0 0 15px;
    border: 2px solid rgb(var(--gray-300));
    transition: var(--transition-fast);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

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

.input-group-text {
    border: 2px solid rgb(var(--gray-300));
    border-right: none;
    border-radius: 15px 0 0 15px;
}

.input-group .btn {
    border-radius: 0 15px 15px 0;
    border: 2px solid rgb(var(--primary));
    border-left: none;
    font-weight: 600;
}

/* Responsive analyze button */
.analyze-btn-text {
    display: inline;
}

.analyze-btn-text-short {
    display: none;
}

/* Mobile responsiveness for input group */
@media (max-width: 576px) {
    .input-group-lg {
        flex-wrap: nowrap; /* Keep elements on same line */
        display: flex;
    }
    
    .input-group-lg .input-group-text {
        flex-shrink: 0; /* Prevent icon from shrinking */
        border-radius: 15px 0 0 15px;
        min-width: 50px;
        justify-content: center;
    }
    
    .input-group-lg .form-control {
        border-radius: 0;
        flex: 1 1 auto; /* Allow input to take remaining space */
        min-width: 0; /* Allow input to shrink if needed */
    }
    
    .input-group-lg .btn {
        border-radius: 0 15px 15px 0;
        flex-shrink: 0; /* Prevent button from shrinking too much */
        min-width: 60px;
        padding: 0.75rem 0.5rem;
    }
    
    .analyze-btn-text {
        display: none;
    }
    
    .analyze-btn-text-short {
        display: inline;
    }
}

/* ========================================
   Examples Section
   ======================================== */

.examples-section {
    padding: 2rem;
    background: rgba(51, 65, 85, 0.8);
    border-radius: 15px;
    margin-top: 2rem;
    border: 1px solid rgba(0, 123, 255, 0.1);
}

.example-card {
    background: rgba(30, 41, 59, 0.9);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
    border: 2px solid rgba(0, 123, 255, 0.2);
    box-shadow: var(--shadow-sm);
    color: rgb(var(--gray-700));
}

.example-card:hover {
    border-color: rgb(var(--primary));
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.example-card i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.example-card small {
    display: block;
    color: rgb(var(--gray-600));
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.example-card code {
    background: rgba(51, 65, 85, 0.8);
    color: rgb(var(--gray-700));
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
    font-size: 0.85rem;
}

/* ========================================
   Features Section
   ======================================== */

.feature-card {
    padding: 2rem 1.5rem;
    border-radius: 15px;
    transition: all 0.3s ease;
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    height: 100%;
    border: 1px solid rgba(0, 123, 255, 0.2);
    color: rgb(var(--gray-700));
    backdrop-filter: blur(10px);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: rgb(var(--primary));
}

.feature-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    position: relative;
    overflow: hidden;
}

.feature-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    transition: all 0.3s ease;
}

.feature-card:hover .feature-svg {
    transform: scale(1.1);
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.25));
}

.cyber-realtime {
    background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(0,136,204,0.1));
    border-radius: 20px;
}

.cyber-risk {
    background: linear-gradient(135deg, rgba(255,107,107,0.1), rgba(255,221,87,0.1));
    border-radius: 20px;
}

.cyber-reports {
    background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
    border-radius: 20px;
}

.cyber-history {
    background: linear-gradient(135deg, rgba(17,153,142,0.1), rgba(56,239,125,0.1));
    border-radius: 20px;
}



.feature-card h5 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: rgb(var(--gray-700));
}

/* ========================================
   Risk Assessment Components
   ======================================== */

.risk-badge {
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.risk-gauge svg {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.risk-card {
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.risk-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    pointer-events: none;
}

/* Risk Level Specific Styles */
.risk-level-high {
    background: var(--bg-gradient-danger);
    color: white;
    animation: pulse-danger 2s infinite;
}

.risk-level-medium {
    background: linear-gradient(135deg, rgb(var(--warning)) 0%, #e0a800 100%);
    color: rgb(var(--dark));
}

.risk-level-low {
    background: linear-gradient(135deg, rgb(var(--info)) 0%, #0aa3d1 100%);
    color: white;
}

.risk-level-clean {
    background: var(--bg-gradient-success);
    color: white;
}

@keyframes pulse-danger {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--danger), 0.7); }
    50% { box-shadow: 0 0 0 20px rgba(var(--danger), 0); }
}

/* ========================================
   Loading States
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--dark), 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content .spinner-border {
    width: 3rem;
    height: 3rem;
    animation: cyber-spin 1s linear infinite;
}

@keyframes cyber-spin {
    0% { 
        transform: rotate(0deg);
        box-shadow: 0 0 10px rgb(var(--cyber-blue));
    }
    50% { 
        box-shadow: 0 0 20px rgb(var(--cyber-blue)), 0 0 30px rgb(var(--cyber-blue));
    }
    100% { 
        transform: rotate(360deg);
        box-shadow: 0 0 10px rgb(var(--cyber-blue));
    }
}

/* Button Loading State */
.btn .btn-spinner {
    transition: var(--transition-fast);
}

/* ========================================
   Form Validation Styles
   ======================================== */

.form-control.is-valid {
    border-color: rgb(var(--success));
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.13-.02.13-.06.7-.72L5.7 3.7c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0L3.16 4.8 2.1 3.7c-.2-.2-.51-.2-.71 0s-.2.51 0 .71l1.31 1.32c.1.1.24.16.4.16z'/%3e%3c/svg%3e");
}

.form-control.is-invalid {
    border-color: rgb(var(--danger));
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 3.7 3.7'/%3e%3cpath d='m5.8 7.2 3.7-3.7'/%3e%3c/svg%3e");
}

.valid-feedback, .invalid-feedback {
    font-weight: 500;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ========================================
   Table Enhancements
   ======================================== */

.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background: var(--bg-gradient-cyber);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background-color: rgb(var(--primary), 0.05);
    transform: scale(1.01);
}

.table tbody td {
    vertical-align: middle;
    border-color: rgb(var(--gray-200));
}

/* ========================================
   Badge Enhancements
   ======================================== */

.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   Modal Enhancements
   ======================================== */

.modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: var(--bg-gradient-cyber);
    color: white;
    border-radius: 20px 20px 0 0;
    border: none;
}

.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

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

footer {
    background: linear-gradient(135deg, rgb(var(--gray-800)) 0%, rgb(var(--gray-900)) 100%);
    margin-top: auto;
}

/* ========================================
   Animations and Effects
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(var(--primary), 0.5); }
    50% { box-shadow: 0 0 20px rgba(var(--primary), 0.8), 0 0 30px rgba(var(--primary), 0.6); }
}

/* Page Load Animations */
.card {
    animation: fadeInUp 0.6s ease-out;
}

.navbar {
    animation: slideInFromLeft 0.8s ease-out;
}

/* Cyber Effect for Special Elements */
.cyber-glow {
    animation: glow 2s infinite;
}

/* ========================================
   Responsive Design
   ======================================== */

/* Mobile Optimizations */
@media (max-width: 768px) {
    .hero-section .display-4 {
        font-size: 2.5rem;
    }
    
    .feature-card {
        margin-bottom: 1.5rem;
    }
    
    .example-card {
        margin-bottom: 1rem;
    }
    
    .input-group-lg .form-control {
        font-size: 1rem;
    }
    
    .error-code {
        font-size: 4rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Desktop Enhancements */
@media (min-width: 1200px) {
    .hero-section {
        padding: 6rem 0;
    }
    
    .feature-card:hover {
        transform: translateY(-8px);
    }
    
    .card:hover {
        transform: translateY(-3px);
    }
}

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

@media print {
    .navbar,
    .loading-overlay,
    .modal,
    footer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid rgb(var(--gray-300));
    }
    
    .bg-primary,
    .bg-danger,
    .bg-success,
    .bg-warning,
    .bg-info {
        background: white !important;
        color: rgb(var(--dark)) !important;
        border: 1px solid rgb(var(--gray-400)) !important;
    }
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

/* Focus States */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--primary), 0.25);
    outline: none;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
        --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.5);
    }
    
    .card {
        border: 2px solid rgb(var(--gray-400));
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Custom Scrollbar
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgb(var(--gray-100));
}

::-webkit-scrollbar-thumb {
    background: rgb(var(--gray-400));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--gray-500));
}

/* ========================================
   Text Readability Fixes
   ======================================== */

/* Ensure all text is readable on dark background */
.text-muted {
    color: rgb(var(--gray-500)) !important;
}

.text-light {
    color: rgb(var(--gray-600)) !important;
}

.lead {
    color: rgb(var(--gray-600)) !important;
}

/* Fix white backgrounds */
.bg-light {
    background: rgba(51, 65, 85, 0.8) !important;
    color: rgb(var(--gray-700)) !important;
}

/* Fix footer text visibility */
footer {
    background: linear-gradient(135deg, rgb(15, 23, 42) 0%, rgb(30, 41, 59) 100%) !important;
    color: rgb(var(--gray-700)) !important;
}

footer h6, footer p, footer small {
    color: rgb(var(--gray-700)) !important;
}

/* Fix API status section */
.api-status-card {
    background: rgba(30, 41, 59, 0.9) !important;
    color: rgb(var(--gray-700)) !important;
    border: 1px solid rgba(0, 123, 255, 0.2) !important;
    backdrop-filter: blur(10px);
}

.api-status-card .card-body {
    background: rgba(30, 41, 59, 0.9) !important;
}

.api-status-card h6, 
.api-status-card p,
.api-status-card span,
.api-status-card div,
.api-status-card * {
    color: rgb(var(--gray-700)) !important;
}

.api-status-card .text-muted {
    color: rgb(var(--gray-500)) !important;
}

/* Override any Bootstrap white text classes */
.api-status-card .text-white,
.api-status-card .text-light,
.card .text-white,
.card .text-light {
    color: rgb(var(--gray-700)) !important;
}

/* Force dark background for any remaining white backgrounds */
.card.bg-white,
.bg-white {
    background: rgba(30, 41, 59, 0.9) !important;
    color: rgb(var(--gray-700)) !important;
}

/* Fix any remaining card with bg-light class */
.card.bg-light {
    background: rgba(30, 41, 59, 0.9) !important;
    color: rgb(var(--gray-700)) !important;
    border: 1px solid rgba(0, 123, 255, 0.2) !important;
}

.card.bg-light h6, 
.card.bg-light p,
.card.bg-light * {
    color: rgb(var(--gray-700)) !important;
}

.card.bg-light .text-muted {
    color: rgb(var(--gray-500)) !important;
}

/* Force override for white text classes */
.card.bg-light .text-white,
.card.bg-light .text-light {
    color: rgb(var(--gray-700)) !important;
}

/* Additional fix for any white backgrounds */
.bg-white {
    background: rgba(30, 41, 59, 0.9) !important;
    color: rgb(var(--gray-700)) !important;
}

/* Ensure all text in cards is visible */
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6,
.card p, .card span, .card div, .card small {
    color: rgb(var(--gray-700)) !important;
}

/* Fix alert backgrounds */
.alert {
    background: rgba(30, 41, 59, 0.9) !important;
    border: 1px solid rgba(0, 123, 255, 0.3) !important;
    color: rgb(var(--gray-700)) !important;
}

/* Fix form control backgrounds */
.form-control {
    background: rgba(51, 65, 85, 0.8) !important;
    border: 2px solid rgba(100, 116, 139, 0.3) !important;
    color: rgb(var(--gray-700)) !important;
}

.form-control:focus {
    background: rgba(51, 65, 85, 0.9) !important;
    color: rgb(var(--gray-700)) !important;
}

.form-control::placeholder {
    color: rgb(var(--gray-500)) !important;
}

/* Fix input group text */
.input-group-text {
    background: rgba(51, 65, 85, 0.8) !important;
    border: 2px solid rgba(100, 116, 139, 0.3) !important;
    color: rgb(var(--gray-700)) !important;
}

/* Fix any remaining white backgrounds */
* {
    --bs-body-bg: transparent !important;
}

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

.text-shadow {
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.box-shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.border-radius-lg {
    border-radius: 20px !important;
}

.gradient-text {
    background: var(--bg-gradient-cyber);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cyber-border {
    border: 2px solid rgb(var(--cyber-blue));
    box-shadow: 0 0 10px rgba(var(--cyber-blue), 0.3);
}
