/* Site-wide custom styles */
html, body {
    height: 100%;
}

/* ============================================================
   Brand Tokens + Bootstrap Overrides (OpenTickets)
   ============================================================ */

:root {
    --ot-primary: #03318c;
    --ot-primary-rgb: 3, 49, 140;
    --ot-primary-deep: #050857;
    --ot-accent: #1f05e6;
    --ot-accent-rgb: 31, 5, 230;
    --ot-ink: #14141f;
    --ot-muted: #757575;
    --ot-light: #f2f2f2;
    --ot-surface: #ffffff;
    --ot-border: #d9dbe7;
    --ot-gradient: linear-gradient(135deg, #03318c 0%, #1f05e6 100%);
    --ot-gradient-soft: linear-gradient(135deg, rgba(3, 49, 140, 0.08), rgba(31, 5, 230, 0.12));
    --ot-gradient-dark: linear-gradient(135deg, #170f32 0%, #04040b 100%);
    --ot-shadow-soft: 0 0.6rem 1.5rem rgba(3, 49, 140, 0.12);
    --ot-shadow-strong: 0 1rem 2.4rem rgba(3, 49, 140, 0.18);

    --bs-primary: var(--ot-primary);
    --bs-primary-rgb: var(--ot-primary-rgb);
    --bs-secondary: var(--ot-accent);
    --bs-secondary-rgb: var(--ot-accent-rgb);
    --bs-body-bg: #f6f7fb;
    --bs-tertiary-bg: #edf1f8;
    --bs-border-color: var(--ot-border);
    --bs-body-color: #242838;
    --bs-secondary-color: var(--ot-muted);
    --bs-body-font-family: "Roboto", "Segoe UI", Arial, sans-serif;
    --bs-link-color: var(--ot-primary);
    --bs-link-hover-color: var(--ot-accent);
    --bs-border-radius: 0.75rem;
    --bs-border-radius-lg: 1rem;
    --bs-border-radius-sm: 0.5rem;
    --bs-focus-ring-color: rgba(var(--ot-primary-rgb), 0.25);
}

[data-bs-theme="dark"] {
    --ot-surface: #141a29;
    --ot-border: #262b3b;
    --ot-shadow-soft: 0 0.6rem 1.5rem rgba(0, 0, 0, 0.4);
    --ot-shadow-strong: 0 1rem 2.4rem rgba(0, 0, 0, 0.6);

    --bs-body-bg: #0f121b;
    --bs-tertiary-bg: #171b27;
    --bs-border-color: var(--ot-border);
    --bs-body-color: #e5e7ef;
    --bs-secondary-color: rgba(255, 255, 255, 0.6);
    --bs-link-color: #9ab1ff;
    --bs-link-hover-color: #c3d1ff;
}

body {
    background:
        radial-gradient(1200px circle at 12% -8%, rgba(3, 49, 140, 0.12), transparent 55%),
        radial-gradient(900px circle at 95% 10%, rgba(31, 5, 230, 0.1), transparent 50%),
        var(--bs-body-bg);
    color: var(--bs-body-color);
    font-family: var(--bs-body-font-family);
    letter-spacing: 0.01em;
}

[data-bs-theme="dark"] body {
    background:
        radial-gradient(1000px circle at 12% -8%, rgba(31, 5, 230, 0.18), transparent 55%),
        var(--bs-body-bg);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: "Jost", "Roboto", "Segoe UI", Arial, sans-serif;
    letter-spacing: 0.01em;
}

/* ============================================================
   Dark/Light Theme Support
   ============================================================ */

/* Theme transition */
* {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.1s ease;
}

/* ============================================================
   Navbar + Page Layout
   ============================================================ */

#page-content-wrapper {
    background: transparent;
}

#page-content-wrapper .navbar {
    background: var(--ot-surface) !important;
    border-bottom: 1px solid var(--ot-border);
    box-shadow: 0 0.35rem 1.2rem rgba(3, 49, 140, 0.08);
}

[data-bs-theme="dark"] #page-content-wrapper .navbar {
    box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.5);
}

#page-content-wrapper .navbar .text-body-secondary {
    color: var(--bs-secondary-color) !important;
}

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

#sidebar-wrapper::-webkit-scrollbar {
    width: 6px;
}

#sidebar-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

#sidebar-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

[data-bs-theme="dark"] #sidebar-wrapper::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   Card Styles
   ============================================================ */

.card {
    background: var(--ot-surface);
    border: 1px solid var(--ot-border);
    box-shadow: var(--ot-shadow-soft);
    transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.card:hover {
    box-shadow: var(--ot-shadow-strong);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--ot-border);
    font-weight: 600;
}

/* ============================================================
   Table Styles
   ============================================================ */

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    font-family: "Jost", "Roboto", "Segoe UI", Arial, sans-serif;
    color: var(--bs-secondary-color);
}

.table-light {
    --bs-table-bg: #f3f6fb;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #1b2130;
}

/* ============================================================
   Loading Spinner (legacy support)
   ============================================================ */

.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--bs-primary);
    animation: spin 1s ease-in-out infinite;
}

[data-bs-theme="dark"] .loading-spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: var(--bs-primary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ============================================================
   Toast Styles
   ============================================================ */

.toast-container .toast {
    animation: slideIn 0.3s ease-out;
}

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

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

.form-control,
.form-select,
.input-group-text {
    border-color: var(--ot-border);
}

.form-control:focus,
.form-select:focus,
.input-group-text:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--ot-primary-rgb), 0.18);
}

.input-group-text {
    background: #f6f8fc;
}

[data-bs-theme="dark"] .input-group-text {
    background: #1c2232;
}

/* File input styling */
.form-control[type="file"] {
    padding: 0.375rem 0.75rem;
}

/* ============================================================
   Button Styles
   ============================================================ */

.btn-primary {
    background: var(--ot-gradient);
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(3, 49, 140, 0.2);
}

.btn-primary:hover,
.btn-primary:focus {
    filter: brightness(1.04);
    box-shadow: 0 0.75rem 1.25rem rgba(3, 49, 140, 0.28);
}

.btn-outline-secondary {
    border-color: rgba(3, 49, 140, 0.2);
    color: var(--bs-body-color);
}

.btn-outline-secondary:hover {
    background-color: rgba(3, 49, 140, 0.08);
    border-color: rgba(3, 49, 140, 0.3);
    color: var(--bs-body-color);
}

.btn-outline-primary {
    border-color: rgba(3, 49, 140, 0.35);
    color: var(--ot-primary);
}

.btn-outline-primary:hover {
    background-color: rgba(3, 49, 140, 0.12);
    border-color: rgba(3, 49, 140, 0.4);
    color: var(--ot-primary);
}

/* ============================================================
   Page Header Styles
   ============================================================ */

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0;
}

/* ============================================================
   Dashboard Stats Cards
   ============================================================ */

.stat-card {
    border-radius: 0.9rem;
    transition: transform 0.15s ease-in-out;
    border: none;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.bg-primary {
    background: var(--ot-gradient) !important;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

/* ============================================================
   Empty State Styles
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state .empty-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--bs-secondary-color);
}

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

.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-h-screen {
    min-height: 100vh;
}

/* ============================================================
   Table Responsive
   ============================================================ */

.table-responsive {
    overflow: visible;
}

.table-responsive .dropdown-menu {
    z-index: 1080;
}

/* ============================================================
   File Upload Area
   ============================================================ */

.upload-area {
    position: relative;
    border: 2px dashed var(--ot-border);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--bs-primary);
    background-color: rgba(var(--ot-primary-rgb), 0.06);
}

.upload-area.has-file {
    border-style: solid;
    border-color: var(--bs-success);
    background-color: rgba(25, 135, 84, 0.05);
    cursor: default;
    text-align: left;
    padding: 1rem;
}

.upload-area .upload-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-area i.display-4 {
    display: block;
}

/* ============================================================
   Release Notes Formatting
   ============================================================ */

.release-notes {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.release-notes p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Table Row Hover
   ============================================================ */

.table-hover tbody tr {
    transition: background-color 0.15s ease-in-out;
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--ot-primary-rgb), 0.05);
}

/* ============================================================
   Dropdown Menu Improvements
   ============================================================ */

.dropdown-menu {
    border: 1px solid var(--ot-border);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12);
}

[data-bs-theme="dark"] .dropdown-menu {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

/* ============================================================
   Modal Improvements
   ============================================================ */

.modal-content {
    border: none;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .modal-content {
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.4);
}

/* ============================================================
   Progress Bar Animation
   ============================================================ */

.progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

/* ============================================================
   Badge Styles
   ============================================================ */

.badge {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ============================================================
   List Group Action Items
   ============================================================ */

.list-group-item-action {
    cursor: pointer;
}

.list-group-item-action:focus {
    z-index: 1;
}
