/* Modern, Clean Stylesheet with Vertical Sidebar for Hexon Billing System */
:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-hover: #1e293b;
    --sidebar-active-bg: #2563eb;
    --sidebar-active-text: #ffffff;
    --sidebar-width: 260px;
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    
    --success: #10b981;
    --success-hover: #059669;
    --success-light: #ecfdf5;
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    
    --secondary: #64748b;
    --secondary-hover: #475569;
    --secondary-light: #f1f5f9;

    --radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Top Navbar */
.navbar {
    background: #0f172a;
    color: #ffffff;
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid #334155;
    color: #94a3b8;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle-btn:hover {
    background: #1e293b;
    color: #ffffff;
}

.navbar .brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.navbar .brand span {
    color: #38bdf8;
}

.navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-db {
    background: #1e293b;
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    border: 1px solid #334155;
}
.badge-db strong {
    color: #38bdf8;
}

/* Layout with Vertical Sidebar */
.layout-wrapper {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 60px);
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    border-right: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    overflow-y: auto;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-content {
    padding: 16px 12px;
    flex: 1;
}

.sidebar-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 12px 12px 6px;
    margin-top: 8px;
}

.sidebar-heading:first-child {
    margin-top: 0;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    color: #94a3b8;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13.5px;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.nav-link.active .badge-table-count {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.badge-table-count {
    font-size: 11px;
    background: #1e293b;
    color: #94a3b8;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
}

/* Submenu */
.submenu {
    list-style: none;
    margin: 2px 0 6px 12px;
    padding-left: 10px;
    border-left: 1px solid #334155;
}

.submenu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    color: #94a3b8;
    font-size: 13px;
    border-radius: 4px;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.submenu-link:hover {
    color: #ffffff;
    background-color: #1e293b;
}

.submenu-link.active {
    color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.1);
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: var(--bg-main);
}

.container {
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 24px 40px;
    flex: 1;
}

/* Breadcrumb & Header bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.15s ease-in-out;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    background-color: var(--success-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-secondary {
    background-color: var(--secondary);
    color: #ffffff;
}
.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: var(--secondary-light);
    border-color: #cbd5e1;
}

.btn-outline-danger {
    background-color: transparent;
    border-color: #fecaca;
    color: var(--danger);
}
.btn-outline-danger:hover {
    background-color: var(--danger-light);
    border-color: var(--danger);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background-color: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background-color: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background-color: var(--primary-light);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Data Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.data-table th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f1f5f9;
}

.data-table .cell-null {
    color: #94a3b8;
    font-style: italic;
}

.data-table .actions-cell {
    white-space: nowrap;
    width: 1%;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-pk {
    background-color: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.badge-count {
    background-color: #e2e8f0;
    color: #334155;
}

/* Grid for Dashboard Tables */
.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.table-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.table-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.table-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.table-card-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 16px;
}

.table-card-actions {
    display: flex;
    gap: 8px;
}

/* Forms & Billing Controls */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #334155;
    font-size: 13px;
}

.form-label .required {
    color: var(--danger);
}

.form-label .col-meta {
    font-weight: normal;
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 6px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 13.5px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #ffffff;
    color: var(--text-main);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Summary Box for Billing */
.billing-summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.billing-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13.5px;
    color: #475569;
}

.billing-summary-row.total {
    border-top: 2px solid #cbd5e1;
    margin-top: 8px;
    padding-top: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-color);
    background-color: #ffffff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 60px;
        bottom: 0;
        left: 0;
        z-index: 999;
        box-shadow: var(--shadow-lg);
    }
}
