/* 
 * FlashPaper Modern UI - Future Subnets Branding
 * Properly working dark mode with CSS variables
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    /* Future Subnets Brand Colors - Light Mode */
    --primary-color: #00447b;
    --primary-hover: #003366;
    --secondary-color: #519031;
    --secondary-hover: #3d6b25;
    --accent-color: #0066cc;
    
    /* UI Colors - Light Mode */
    --background: #f8f9fa;
    --card-background: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px -1px rgba(0, 68, 123, 0.1), 0 2px 4px -2px rgba(0, 68, 123, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 68, 123, 0.1), 0 8px 10px -6px rgba(0, 68, 123, 0.1);
}

/* Dark mode colors */
html[data-bs-theme="dark"] {
    --primary-color: #0066cc;
    --primary-hover: #0052a3;
    --secondary-color: #6aad45;
    --secondary-hover: #519031;
    --accent-color: #0088ff;
    
    --background: #0f1419;
    --card-background: #1a2332;
    --text-primary: #f8f9fa;
    --text-secondary: #9ca3af;
    --border-color: #374151;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* ============================================
   BASE STYLES
   ============================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background) !important;
    color: var(--text-primary) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   NAVBAR
   ============================================ */

.navbar {
    background: var(--card-background);
    border-bottom: 2px solid var(--primary-color);
    padding: 1rem 0;
}

.navbar-brand img {
    max-height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.navbar-brand img:hover {
    transform: scale(1.05);
}

/* ============================================
   FORM CONTAINER
   ============================================ */

#form-div {
    background: var(--card-background);
    border-radius: 16px;
    padding: 3rem;
    margin: 3rem auto;
    max-width: 800px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

#form-div:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 68, 123, 0.15);
    transform: translateY(-2px);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, .form-label {
    color: var(--text-primary);
    font-weight: 600;
}

label[style*="font-size: 30px"],
label[style*="font-size: 2rem"] {
    font-family: 'Inter', sans-serif !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
    color: var(--primary-color) !important;
    margin-bottom: 1rem !important;
}

html[data-bs-theme="dark"] label[style*="font-size: 30px"],
html[data-bs-theme="dark"] label[style*="font-size: 2rem"] {
    color: #4da3ff !important;
}

label[style*="font-size: 15px"] {
    font-family: 'Inter', sans-serif !important;
    font-size: 1rem !important;
    color: var(--text-secondary) !important;
    font-weight: 400 !important;
    margin-bottom: 1.5rem !important;
}

/* ============================================
   FORM INPUTS
   ============================================ */

textarea.form-control {
    background: var(--background) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 12px;
    padding: 1rem;
    font-size: 0.95rem;
    color: var(--text-primary) !important;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 200px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

textarea.form-control:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(0, 68, 123, 0.1);
    background: var(--card-background) !important;
}

textarea.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-select {
    background: var(--background) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--text-primary) !important;
    transition: all 0.3s ease;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(0, 68, 123, 0.1);
}

.form-select:hover {
    border-color: var(--primary-color);
}

.form-control[readonly] {
    background: linear-gradient(135deg, rgba(0, 68, 123, 0.05), rgba(81, 144, 49, 0.05));
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    color: var(--primary-color);
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    opacity: 1;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover)) !important;
    border: none !important;
    color: white !important;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 68, 123, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 68, 123, 0.4);
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color)) !important;
    color: white !important;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(0, 68, 123, 0.3);
}

.btn-outline-secondary {
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    background: var(--background);
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    border-left: 4px solid var(--secondary-color);
}

html[data-bs-theme="dark"] .alert-danger {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: #fecaca;
}

html[data-bs-theme="dark"] .alert-warning {
    background: linear-gradient(135deg, #78350f, #92400e);
    color: #fde68a;
}

html[data-bs-theme="dark"] .alert-success {
    background: linear-gradient(135deg, #064e3b, #065f46);
    color: #a7f3d0;
}

/* ============================================
   DARK MODE TOGGLE
   ============================================ */

.form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
    border: 2px solid var(--border-color);
    background-color: var(--background);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 68, 123, 0.25);
}

.fa-solid {
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.nav-item:hover .fa-solid {
    color: var(--primary-color);
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: var(--card-background) !important;
    border-top: 2px solid var(--primary-color);
    padding: 1rem 0;
    font-size: 0.875rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* ============================================
   CHARACTER COUNTER
   ============================================ */

.char-counter {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

textarea:focus ~ .char-counter {
    color: var(--primary-color);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    #form-div {
        padding: 2rem 1.5rem;
        margin: 1.5rem;
    }
    
    label[style*="font-size: 30px"] {
        font-size: 1.5rem !important;
    }
    
    .btn-primary {
        width: 100%;
        margin-top: 1rem;
    }
    
    .form-select {
        width: 100%;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

#form-div {
    animation: fadeInUp 0.5s ease-out;
}

/* ============================================
   SCROLLBAR
   ============================================ */

html {
    scroll-behavior: smooth;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ============================================
   TEXT SELECTION
   ============================================ */

::selection {
    background-color: var(--primary-color);
    color: white;
}

::-moz-selection {
    background-color: var(--primary-color);
    color: white;
}

/* ============================================
   LINKS
   ============================================ */

a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

/* ============================================
   UTILITIES
   ============================================ */

.text-success,
.badge-success {
    color: var(--secondary-color) !important;
    background-color: rgba(81, 144, 49, 0.1);
}

.spinner-border {
    color: var(--primary-color);
}

.navbar-toggler {
    border-color: var(--primary-color);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(0, 68, 123, 0.25);
}

.mx-auto {
    max-width: 600px;
}

fieldset {
    margin: 10px;
    border: 0;
}
