/* ==================================
   Futuristic Dark Theme - Responsive
   Mobile-First Design with Bootstrap 5
   ================================== */

:root {
    /* Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #131720;
    --bg-tertiary: #1a1f2e;
    --accent-primary: #00d9ff;
    --accent-secondary: #7b2cbf;
    --accent-gradient: linear-gradient(135deg, #00d9ff 0%, #7b2cbf 100%);
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --border-color: #27272a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Spacing - responsive */
    --spacing-xs: clamp(0.25rem, 0.5vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 1vw, 0.75rem);
    --spacing-md: clamp(1rem, 2vw, 1.5rem);
    --spacing-lg: clamp(1.5rem, 3vw, 2rem);
    --spacing-xl: clamp(2rem, 4vw, 3rem);
    
    /* Typography */
    --font-size-sm: clamp(0.875rem, 0.875rem + 0.1vw, 0.9375rem);
    --font-size-base: clamp(1rem, 1rem + 0.1vw, 1.125rem);
    --font-size-lg: clamp(1.125rem, 1.125rem + 0.2vw, 1.25rem);
    --font-size-xl: clamp(1.25rem, 1.25rem + 0.5vw, 1.5rem);
    --font-size-2xl: clamp(1.5rem, 1.5rem + 1vw, 2rem);
    --font-size-3xl: clamp(2rem, 2rem + 2vw, 3.5rem);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================================
   Navigation - Mobile First
   ================================== */

.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-size: var(--font-size-xl);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.navbar-toggler {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
}

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

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(228, 228, 231, 0.75)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.nav-link {
    color: var(--text-secondary) !important;
    text-decoration: none;
    transition: color 0.3s;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.nav-link:hover {
    color: var(--accent-primary) !important;
    background: rgba(0, 217, 255, 0.05);
}

/* ==================================
   Buttons - Responsive
   ================================== */

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    font-size: var(--font-size-base);
    line-height: 1.5;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.625rem 1.875rem rgba(0, 217, 255, 0.3);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--font-size-lg);
}

/* Stack buttons on mobile */
@media (max-width: 576px) {
    .btn-group-mobile-stack .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ==================================
   Layout - Fluid Containers
   ================================== */

.main-content {
    min-height: calc(100vh - 4rem);
    padding: var(--spacing-md);
}

.container {
    max-width: 100%;
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ==================================
   Cards - Responsive
   ================================== */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    transition: all 0.3s;
}

.card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0.625rem 2.5rem rgba(0, 217, 255, 0.1);
}

.card-header {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 768px) {
    .card {
        padding: var(--spacing-lg);
    }
}

/* ==================================
   Hero Section - Responsive
   ================================== */

.hero {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
    background: radial-gradient(circle at 50% 50%, rgba(0, 217, 255, 0.1) 0%, transparent 70%);
}

.hero h1 {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    margin-bottom: var(--spacing-md);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.hero p {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

/* ==================================
   Feature Grid - Responsive
   ================================== */

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

/* Tablet and up: 3 columns */
@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--spacing-lg);
    }
}

/* ==================================
   Forms - Mobile Friendly
   ================================== */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.1875rem rgba(0, 217, 255, 0.1);
}

/* Placeholder text styling */
.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

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

input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

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

.form-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 0.1875rem rgba(0, 217, 255, 0.1);
}

/* ==================================
   File List - Responsive
   ================================== */

.file-list {
    list-style: none;
    padding: 0;
}

.file-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.file-item:hover {
    border-color: var(--accent-primary);
}

.file-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.file-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-sm);
    flex-shrink: 0;
}

.file-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Stack file items better on larger screens */
@media (min-width: 768px) {
    .file-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .file-actions {
        flex-wrap: nowrap;
    }
}

/* ==================================
   Tables - Horizontal Scroll on Mobile
   ================================== */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr:hover {
    background: rgba(0, 217, 255, 0.05);
}

/* ==================================
   Status Badges
   ================================== */

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: var(--font-size-sm);
    font-weight: 600;
    display: inline-block;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-completed {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.status-drilling {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-abandoned {
    background: rgb(138, 41, 0, 0.2);
    color: var(--warning);
}

/* ==================================
   Upload Area - Responsive
   ================================== */

.upload-area {
    border: 0.125rem dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 217, 255, 0.05);
}

.upload-area.dragover {
    border-color: var(--accent-primary);
    background: rgba(0, 217, 255, 0.1);
}

/* ==================================
   Visualization Container - Fluid
   ================================== */

.viz-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-top: var(--spacing-lg);
    width: 100%;
    overflow-x: auto;
}

/* Make Plotly charts responsive */
.plotly-graph-div {
    width: 100% !important;
    height: auto !important;
    min-height: 400px;
}

@media (min-width: 768px) {
    .plotly-graph-div {
        min-height: 500px;
    }
}

@media (min-width: 1200px) {
    .plotly-graph-div {
        min-height: 600px;
    }
}

/* ==================================
   User Profile
   ================================== */

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 0.125rem solid var(--accent-primary);
    flex-shrink: 0;
}

/* ==================================
   Modal - Responsive
   ================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
    padding: var(--spacing-md);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    max-width: 31.25rem;
    width: 100%;
    text-align: center;
    box-shadow: 0 1.25rem 3.75rem rgba(0, 0, 0, 0.5);
}

.modal-icon {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: var(--spacing-md);
    font-weight: bold;
}

.modal-title {
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-xl);
}

.modal-message {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    justify-content: center;
}

@media (min-width: 576px) {
    .modal-buttons {
        flex-direction: row;
        gap: var(--spacing-md);
    }
}

.modal-btn {
    min-width: 6.25rem;
}

/* ==================================
   Utilities
   ================================== */

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

.glow {
    box-shadow: 0 0 1.25rem rgba(0, 217, 255, 0.3);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

/* Prevent horizontal overflow */
.overflow-x-hidden {
    overflow-x: hidden;
}

/* Fluid images and videos */
img,
video {
    max-width: 100%;
    height: auto;
}

/* ==================================
   Animations
   ================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================================
   Loading Spinner
   ================================== */

.spinner {
    border: 0.1875rem solid var(--bg-tertiary);
    border-top: 0.1875rem solid var(--accent-primary);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* ==================================
   Scrollbar Styling (Webkit)
   ================================== */

::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ==================================
   Bootstrap Dark Theme Overrides
   ================================== */

/* Override Bootstrap text utility classes for dark theme readability */
.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-secondary) !important;
    opacity: 0.8;
}

.text-body-secondary {
    color: var(--text-secondary) !important;
}

/* On dark themes, "text-dark" should actually be light */
.text-dark {
    color: var(--text-primary) !important;
}

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

/* Override Bootstrap's default text color for better contrast */
body,
.text-body {
    color: var(--text-primary);
}

/* Small text helper classes */
.small,
small {
    color: var(--text-secondary);
}

/* Form text helpers */
.form-text {
    color: var(--text-secondary) !important;
}

/* Bootstrap badge overrides for dark theme */
.badge {
    color: #ffffff !important;
}

.badge.bg-secondary {
    background-color: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color);
}

/* Link color overrides */
a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    color: #00ffff;
    text-decoration: underline;
}

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

@media print {
    .navbar,
    .btn,
    .file-actions {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}
