/* static/style.css */

/* ==========================================================================
   1. Theme Color Variables
   ========================================================================== */
:root {
  --theme-primary-red: #c92325;
  --theme-primary-red-darker: #a31c1e; /* A slightly darker red for hovers/borders if needed */
  --theme-text-light: #ffffff;
  --theme-text-dark: #000000;
  --theme-text-muted: rgba(255, 255, 255, 0.75);

  --theme-bg-body: #121212; /* Main background */
  --theme-bg-content: #1e1e1e; /* Cards, modals */
  --theme-bg-input: #2c2c2c; /* Form inputs */
  --theme-bg-table: #0f0f0f;
  --theme-bg-table-dark: #090909;
  --theme-bg-navbar: #1e1e1e; /* (was rgb(30,30,30)) Matched to content bg for consistency */
  --theme-bg-hover-dark: #0f0e0e;

  --theme-border-light: #444444;
  --theme-border-dark: #000000;
  --theme-border-primary: var(--theme-primary-red);

  /* Bootstrap variable overrides - more specific to Bootstrap components */
  --bs-body-bg: var(--theme-bg-body);
  --bs-body-color: var(--theme-text-light);
  --bs-emphasis-color: var(--theme-text-light); /* For text emphasis */
  --bs-secondary-color: var(--theme-text-muted); /* For less important text */
}

/* ==========================================================================
   2. General Body & Typography
   ========================================================================== */
body {
  background-color: var(--bs-body-bg); /* Uses Bootstrap variable, which uses our theme var */
  color: var(--bs-body-color); /* Uses Bootstrap variable, which uses our theme var */
}

.text-muted {
  --bs-text-opacity: 1; /* Ensure full opacity for our custom muted color */
  color: var(--theme-text-muted) !important; /* Overriding Bootstrap's default muted */
}

.text-secondary { /* Assuming you want .text-secondary to be clearly visible */
  --bs-text-opacity: 1;
  color: var(--theme-text-light) !important;
}

/* ==========================================================================
   3. Navbar Styling
   ========================================================================== */
.bg-secondary { /* This class is used for the navbar background in your HTML */
  --bs-bg-opacity: 1;
  background-color: var(--theme-bg-navbar) !important;
}

.navbar-brand {
  display: flex;
  align-items: center;
  color: var(--theme-text-light); /* Ensure brand text is light */
}

.navbar-brand img {
  max-height: 40px; /* Adjusted for typical navbar height, can be tuned */
  margin-right: 0.75rem; /* Space between logo and text */
}

.navbar > .container { /* For vertical centering of navbar items */
  align-items: center;
}

.nav { /* Styling for nav links, if used outside of .navbar-nav */
  --bs-nav-link-padding-x: 1rem;
  --bs-nav-link-padding-y: 0.5rem;
  --bs-nav-link-color: var(--theme-primary-red);
  --bs-nav-link-hover-color: var(--theme-primary-red-darker);
  --bs-nav-link-disabled-color: var(--theme-text-muted);
  list-style: none;
}

.navbar-nav .nav-link {
    color: var(--theme-text-light); /* Default color for navbar links */
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    color: var(--theme-primary-red); /* Red on hover/focus */
}

.navbar-text { /* For "Welcome, user" text */
    color: var(--theme-text-muted);
}


/* ==========================================================================
   4. Card Styling
   ========================================================================== */
.card {
  background-color: var(--theme-bg-content);
  color: var(--theme-text-light);
  border: 1px solid var(--theme-border-light); /* Added a subtle border */
}

.card-header {
    background-color: rgba(0,0,0,0.1); /* Slightly darker header for cards */
    border-bottom: 1px solid var(--theme-border-light);
}

/* ==========================================================================
   5. Modal Styling
   ========================================================================== */
.modal-content {
  background-color: var(--theme-bg-content);
  color: var(--theme-text-light);
  border: 1px solid var(--theme-border-light);
}

.modal-header {
    border-bottom: 1px solid var(--theme-border-light);
}
.modal-footer {
    border-top: 1px solid var(--theme-border-light);
}

/* ==========================================================================
   6. Form Control Styling
   ========================================================================== */
.form-control {
  background-color: var(--theme-bg-input);
  color: var(--theme-text-light);
  border: 1px solid var(--theme-border-light);
}

.form-control::placeholder {
  color: var(--theme-text-muted);
  opacity: 0.8; /* Make placeholder slightly less prominent */
}

.form-control:focus {
  background-color: var(--theme-bg-input);
  color: var(--theme-text-light);
  border-color: var(--theme-primary-red); /* Red border on focus */
  box-shadow: 0 0 0 0.25rem rgba(var(--theme-primary-red-rgb), 0.25); /* Use RGB for box-shadow */
}

/* For Bootstrap's floating labels, if you use them */
.form-floating > .form-control {
    background-color: var(--theme-bg-input);
}

/* ==========================================================================
   7. Button Styling
   ========================================================================== */
/* General Button Hover - more subtle, let specific buttons define strong color */
.btn:hover {
  filter: brightness(1.15); /* Slightly brighten any button on hover */
}

/* Primary Button (e.g., main action, not used in current HTML but good to define) */
.btn-primary {
  --bs-btn-color: var(--theme-text-light);
  --bs-btn-bg: var(--theme-primary-red);
  --bs-btn-border-color: var(--theme-primary-red);
  --bs-btn-hover-color: var(--theme-text-light);
  --bs-btn-hover-bg: var(--theme-primary-red-darker);
  --bs-btn-hover-border-color: var(--theme-primary-red-darker);
  --bs-btn-active-bg: var(--theme-primary-red-darker);
  --bs-btn-active-border-color: var(--theme-primary-red-darker);
}

/* Success Button (Used for "Link UID") */
.btn-success {
  --bs-btn-color: var(--theme-text-light);
  --bs-btn-bg: var(--theme-primary-red); /* Using primary red for success actions */
  --bs-btn-border-color: var(--theme-primary-red);
  --bs-btn-hover-color: var(--theme-primary-red);
  --bs-btn-hover-bg: #000;
  --bs-btn-hover-border-color: var(--theme-primary-red-darker);
  --bs-btn-active-bg: var(--theme-primary-red-darker);
  --bs-btn-active-border-color: var(--theme-primary-red-darker);
}

/* Info Button (Outline - Download Plugin) */
.btn-outline-info {
  --bs-btn-color: var(--theme-primary-red); /* Red text */
  --bs-btn-border-color: var(--theme-primary-red); /* Red border */
  --bs-btn-hover-color: var(--theme-text-light); /* White text on hover */
  --bs-btn-hover-bg: var(--theme-primary-red); /* Red background on hover */
  --bs-btn-hover-border-color: var(--theme-primary-red);
  --bs-btn-active-bg: var(--theme-primary-red-darker);
  --bs-btn-active-border-color: var(--theme-primary-red-darker);
}

/* Light Button (Outline - Logout) */
.btn-outline-light {
  --bs-btn-color: var(--theme-text-muted); /* Muted text for less emphasis */
  --bs-btn-border-color: var(--theme-text-muted);
  --bs-btn-hover-color: var(--theme-text-light);
  --bs-btn-hover-bg: var(--theme-primary-red); /* Red background on hover */
  --bs-btn-hover-border-color: var(--theme-primary-red);
  --bs-btn-active-bg: var(--theme-primary-red-darker);
  --bs-btn-active-border-color: var(--theme-primary-red-darker);
}

/* Danger Button (If you add delete buttons, etc.) */
.btn-danger {
  --bs-btn-color: var(--theme-text-light);
  --bs-btn-bg: var(--theme-primary-red); /* Or a different shade of red if needed for distinction */
  --bs-btn-border-color: var(--theme-primary-red);
  --bs-btn-hover-color: var(--theme-primary-red);
  --bs-btn-hover-bg: #000;
}

/* Adjusting button vertical alignment if needed (your previous style) */
.btn-sm.btn-danger,
.btn-sm.btn-info {
  position: relative;
  top: 2px;
}

/* ==========================================================================
   8. Table Styling
   ========================================================================== */
.table {
  --bs-table-color: var(--theme-text-light);
  --bs-table-bg: var(--theme-bg-table);
  --bs-table-border-color: var(--theme-border-dark);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03); /* Subtle striping */
  --bs-table-hover-color: var(--theme-text-light);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.075); /* Slightly more prominent hover */
  text-align: center; /* Typically tables are left-aligned for readability, center if preferred */
  vertical-align: middle;
}

.table th {
    color: var(--theme-text-muted); /* Table headers slightly muted */
    font-weight: 600;
}

/*
   If you specifically use .table-dark, it will inherit from .table
   and then apply these specific overrides.
*/
.table-dark {
  --bs-table-color: var(--theme-text-light);
  --bs-table-bg: var(--theme-bg-table-dark); /* Even darker background for .table-dark */
  --bs-table-border-color: var(--theme-border-dark);
  --bs-table-hover-color: var(--theme-text-light);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   9. Alert Styling
   ========================================================================== */
.alert {
    border-width: 2px; /* Make alert borders a bit more prominent */
    border-left-width: 5px; /* Strong left border for emphasis */
}

/* Success Alert (Used for flash messages) */
.alert-success {
  --bs-alert-color: var(--theme-text-light);
  --bs-alert-bg: rgba(202, 49, 50, 0.6); /* Light red background */
  --bs-alert-border-color: var(--theme-primary-red);
  --bs-alert-link-color: var(--theme-primary-red-darker); /* Darker red for links */
  border-left-color: var(--theme-primary-red) !important;
}

/* Info Alert (Used for flash messages) */
.alert-info {
  --bs-alert-color: var(--theme-text-light);
  --bs-alert-bg: rgba(var(--theme-primary-red-rgb), 0.2);
  --bs-alert-border-color: var(--theme-primary-red);
  --bs-alert-link-color: var(--theme-primary-red-darker);
  border-left-color: var(--theme-primary-red) !important;
}

/* Warning Alert (Used for flash messages) */
.alert-warning {
  --bs-alert-color: var(--theme-text-light);
  --bs-alert-bg: rgba(var(--theme-primary-red-rgb), 0.2);
  --bs-alert-border-color: var(--theme-primary-red);
  --bs-alert-link-color: var(--theme-primary-red-darker);
  border-left-color: var(--theme-primary-red) !important;
}

/* Danger Alert (If you use it for errors) */
.alert-danger {
  --bs-alert-color: var(--theme-text-light);
  --bs-alert-bg: rgba(var(--theme-primary-red-rgb), 0.3); /* Slightly stronger red for danger */
  --bs-alert-border-color: var(--theme-primary-red);
  --bs-alert-link-color: var(--theme-primary-red-darker);
  border-left-color: var(--theme-primary-red) !important;
}

.alert .btn-close { /* Style the close button on alerts for dark theme */
    filter: invert(1) grayscale(100%) brightness(200%);
}


/* ==========================================================================
   10. Miscellaneous & Overrides
   ========================================================================== */
.bg-dark { /* Your custom .bg-dark from HTML */
  --bs-bg-opacity: 1;
  background-color: var(--theme-bg-table) !important; /* Using table background for consistency if it's a main content area */
}

/* Helper to convert hex to RGB for rgba() usage, if needed for box-shadows or backgrounds */
:root {
  /* Example: --theme-primary-red: #c92325; */
  --theme-primary-red-rgb: 201, 35, 37; /* Manually define RGB for your red */
}

/* Badge styling for UIDs in the table */
.badge.bg-primary { /* Assuming you want to use your theme red for primary badges */
    background-color: var(--theme-primary-red) !important;
    color: var(--theme-text-light) !important;
}

/* Ensure links are generally visible and use theme color on hover */
a {
    color: var(--theme-primary-red);
    text-decoration: none; /* Optional: remove underline from all links */
}

a:hover {
    color: var(--theme-primary-red-darker);
    text-decoration: underline; /* Optional: add underline on hover */
}

/* Ensure flashed message links also follow the theme */
.alert a, .alert a:hover {
    color: var(--bs-alert-link-color);
    font-weight: bold;
}
