@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-blue: #00D2FF; /* Neon Cyan */
    --primary-hover: #00A3C4;
    --soft-gray: #0B0F19; /* Deep Space Black/Blue */
    --accent-emerald: #10B981;
    --danger-red: #EF4444;
    --dark-text: #F8FAFC; /* Light gray text */
    --light-text: #94A3B8; /* Muted gray text */
    --card-bg: rgba(15, 23, 42, 0.75);
    --border-color: rgba(6, 182, 212, 0.2);
}

body {
    background-color: var(--soft-gray);
    background-image: linear-gradient(rgba(11, 15, 25, 0.88), rgba(11, 15, 25, 0.94)), url('/static/img/tech_bg.png');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    font-family: 'Inter', sans-serif;
    color: var(--dark-text);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #FFFFFF;
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}

.text-muted {
    color: var(--light-text) !important;
}

/* Navbar */
.navbar {
    transition: all 0.3s ease-in-out;
    background-color: rgba(11, 15, 25, 0.95) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 1.2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
}

.navbar.scrolled {
    background-color: rgba(7, 10, 18, 0.98) !important;
    padding: 0.8rem 0;
    box-shadow: 0 6px 30px rgba(0, 210, 255, 0.15);
}

.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    color: #FFFFFF !important;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

.nav-link {
    font-weight: 500;
    color: var(--light-text) !important;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: #FFFFFF !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--primary-blue);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

/* Hero Section */
.hero-icon {
    font-size: 5.5rem;
    color: var(--primary-blue);
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(0, 210, 255, 0.5));
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 210, 255, 0.15);
    border-color: rgba(0, 210, 255, 0.4);
}

.card-header {
    border-bottom: none;
    padding: 1.5rem;
}

/* Form Input */
.form-floating > .form-control {
    background: rgba(15, 23, 42, 0.8) !important;
    border-radius: 12px;
    border: 2px solid rgba(6, 182, 212, 0.15);
    padding-left: 3rem;
    font-weight: 500;
    font-size: 1.1rem;
    color: #FFFFFF;
    transition: all 0.3s ease;
}

.form-floating > .form-control:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.25);
    color: #FFFFFF;
}

.form-floating > label {
    color: var(--light-text);
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 1.2rem;
    transform: translateY(-50%);
    color: var(--light-text);
    z-index: 10;
    transition: color 0.3s ease;
}

.form-control:focus ~ .input-icon {
    color: var(--primary-blue);
}

.char-counter {
    font-size: 0.85rem;
    color: var(--light-text);
    text-align: right;
    margin-top: 0.5rem;
    transition: color 0.3s;
}

.char-counter.invalid {
    color: var(--danger-red);
}

.char-counter.valid {
    color: var(--accent-emerald);
}

/* Buttons */
.btn {
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: #0B0F19;
    border: none;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

.btn-primary:hover {
    background-color: #FFFFFF;
    color: #0B0F19;
    transform: scale(1.02);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.5);
}

/* Button Ripple */
.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 0.6s linear;
    background-color: rgba(255, 255, 255, 0.4);
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Info Cards (Result Page) */
.info-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--primary-blue);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.3s, border-color 0.3s;
}

.info-card:hover {
    transform: translateX(5px);
    border-color: rgba(0, 210, 255, 0.4);
}

.info-icon {
    width: 60px;
    height: 60px;
    background: rgba(0, 210, 255, 0.1);
    color: var(--primary-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(0, 210, 255, 0.3));
}

.info-content h6 {
    color: var(--light-text);
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-content h4 {
    margin: 0;
    color: #FFFFFF;
    font-weight: 700;
}

/* DFA Visualizer */
.dfa-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 2.5rem 0;
}

.dfa-state {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(30, 41, 59, 0.8);
    color: var(--light-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.5s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    opacity: 0.6;
}

.dfa-arrow {
    color: rgba(255, 255, 255, 0.2);
    font-size: 1.2rem;
    transition: all 0.5s ease;
    opacity: 0.6;
}

.dfa-state.active {
    background-color: rgba(0, 210, 255, 0.2);
    color: var(--primary-blue);
    border-color: var(--primary-blue);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.6);
    transform: scale(1.15);
    opacity: 1;
}

.dfa-state.passed {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
    border-color: var(--accent-emerald);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    opacity: 1;
}

.dfa-state.reject {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--danger-red);
    border-color: var(--danger-red);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    opacity: 1;
    animation: shake 0.5s ease-in-out;
}

.dfa-arrow.passed {
    color: var(--accent-emerald);
    opacity: 1;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

/* Footer */
footer {
    background-color: rgba(11, 15, 25, 0.95);
    padding: 2.5rem 0;
    margin-top: 5rem;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
    border-top: 1px solid var(--border-color);
}

/* Status Cards */
.status-card {
    text-align: center;
    padding: 2.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
}
.status-card.valid {
    background-color: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--accent-emerald);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}
.status-card.invalid {
    background-color: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger-red);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}
.status-icon {
    font-size: 4.5rem;
    margin-bottom: 1rem;
}
.status-card.valid .status-icon {
    color: var(--accent-emerald);
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.5));
}
.status-card.invalid .status-icon {
    color: var(--danger-red);
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
}

/* Accordion */
.accordion-item {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid var(--border-color) !important;
    margin-bottom: 0.5rem;
    border-radius: 12px !important;
}

.accordion-button {
    background-color: transparent !important;
    color: #FFFFFF !important;
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background-color: rgba(0, 210, 255, 0.1) !important;
    color: var(--primary-blue) !important;
    box-shadow: none;
}
.accordion-button:focus {
    box-shadow: none;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.7) !important;
    border: 1px solid var(--border-color);
}
.timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary-blue);
    opacity: 0.4;
}
.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.35rem;
    top: 0.25rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--primary-blue);
    border: 3px solid #0B0F19;
    box-shadow: 0 0 0 2px var(--primary-blue);
}

/* General Layout Fixes */
.bg-light {
    background-color: rgba(15, 23, 42, 0.5) !important;
    border-color: var(--border-color) !important;
}
.border {
    border-color: var(--border-color) !important;
}

/* Color overrides for Bootstrap classes */
.bg-primary, .btn-primary {
    background-color: var(--primary-blue) !important;
    color: #0B0F19 !important;
}

.text-primary {
    color: var(--primary-blue) !important;
}

.badge.bg-primary {
    background-color: var(--primary-blue) !important;
    color: #0B0F19 !important;
}

/* Global button text color correction */
.btn-primary:hover {
    background-color: #FFFFFF !important;
    color: #0B0F19 !important;
}

/* Ensure general text elements inherit the light text color in dark theme */
p, li, td, th {
    color: var(--dark-text);
}