﻿/*
 * Modern UI Overhaul for SADRP Panel
 * Style: Clean, Smooth, Glassmorphism
 */

/* Google Fonts Import - Moved to head.inc.php */

:root {
    --card-bg: rgba(30, 35, 45, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --body-bg: #121418;
    --primary-color: #556ee6;
    /* Keeping original primary or adjusting slightly */
    --text-color: #e9ecef;
    --muted-color: #adb5bd;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --transition: all 0.25s ease-in-out;
}

/* CRITICAL: Force body and html to allow full scrolling */
html,
body {
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

body {
    font-family: 'Inter', sans-serif !important;
    background-color: var(--body-bg) !important;
    color: var(--text-color) !important;
    background: radial-gradient(circle at top center, #2a3042 0%, #121418 80%) !important;
}

/* Centering Helper */
.fa-center-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2) !important;
    transition: var(--transition);
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

.card:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.card-header,
.card-footer {
    background-color: transparent !important;
    border-bottom: 1px solid var(--card-border) !important;
    border-top: 1px solid var(--card-border) !important;
}

.card-body {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
    font-weight: 600 !important;
    color: #ffffff !important;
}

/* Buttons */
.btn {
    border-radius: var(--radius-md) !important;
    padding: 0.5rem 1.2rem;
    font-weight: 500;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #556ee6 0%, #344ceb 100%) !important;
    box-shadow: 0 4px 15px rgba(85, 110, 230, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(85, 110, 230, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #34c38f 0%, #1a9e6e 100%) !important;
    box-shadow: 0 4px 15px rgba(52, 195, 143, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #f46a6a 0%, #d63d3d 100%) !important;
    box-shadow: 0 4px 15px rgba(244, 106, 106, 0.35);
}

.btn:hover {
    transform: translateY(-2px);
}

/* Form Inputs */
.form-control {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: var(--radius-md) !important;
    color: #fff !important;
    padding: 0.6rem 1rem;
}

.form-control:focus {
    background-color: rgba(0, 0, 0, 0.3) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(85, 110, 230, 0.25) !important;
}

/* Sidebar & Navbar */
#sidebar-menu {
    border-right: 1px solid var(--card-border);
}

.navbar-header {
    background-color: rgba(30, 35, 45, 0.8) !important;
    backdrop-filter: blur(10px);
}

.vertical-menu {
    background-color: var(--body-bg) !important;
}

/* Tables */
.table {
    color: var(--text-color) !important;
    border-color: var(--card-border) !important;
}

.table th {
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--muted-color);
    border-bottom: 2px solid var(--card-border) !important;
}

.table td {
    border-top: 1px solid var(--card-border) !important;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Modals - Comprehensive Fix */
.modal {
    overflow-y: auto !important;
}

.modal-dialog {
    margin: 1.75rem auto !important;
}

.modal-content {
    background-color: #1a1d24 !important;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header,
.modal-footer {
    border-color: var(--card-border) !important;
    flex-shrink: 0;
}

.modal-body {
    overflow-y: visible !important;
    max-height: none !important;
}

/* CRITICAL FIX: Keep modal backdrop visible but don't let it block the page */
.modal-backdrop {
    opacity: 0.5 !important;
    /* Visible but semi-transparent */
    pointer-events: none !important;
    /* Don't block clicks on the page */
}

.modal-backdrop.show {
    opacity: 0.5 !important;
}

/* Ensure body scrolling is never disabled by Bootstrap modals */
body.modal-open {
    overflow: auto !important;
    padding-right: 0 !important;
}

/* Make modal appear above everything including the backdrop */
.modal {
    z-index: 9999 !important;
}

.modal-dialog {
    z-index: 10000 !important;
    pointer-events: all !important;
    /* Modal itself should be clickable */
}

/* NUCLEAR OPTION: Force ALL containers to allow scrolling */
#layout-wrapper {
    min-height: 100vh !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.main-content {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin-left: 250px;
}

.page-content {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: calc(70px + 24px) calc(24px * .75) 200px calc(24px * .75) !important;
    /* Extra bottom padding for footer */
}

/* Fix absolutely positioned footer that was overlapping content */
.footer {
    position: relative !important;
    /* Change from absolute to relative */
    left: auto !important;
    bottom: auto !important;
    margin-top: 40px !important;
}

.container-fluid {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

.row {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

.col,
[class*="col-"] {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Table Container Fixes */
.table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
    max-height: none !important;
}

/* DataTables Styling Overrides */
div.dataTables_wrapper div.dataTables_filter input {
    margin-left: 0.5em;
    display: inline-block;
    width: auto;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: #fff;
}

div.dataTables_wrapper div.dataTables_length select {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #121418;
}

::-webkit-scrollbar-thumb {
    background: #404450;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #505460;
}

/* Utilities */
.text-muted {
    color: #9aa1b9 !important;
}