/* ============================================================
   SEC APP - LAYOUT
   FILE: assets/css/layout.css
   ============================================================
   PURPOSE
   ------------------------------------------------------------
   Core application shell layout:
   - fixed sidebar
   - main content area
   - page header alignment
   - responsive behavior

   WHY THIS FIXES THE ISSUE
   ------------------------------------------------------------
   The earlier layout allowed the sidebar to behave like a normal
   block element in document flow. As a result, the page content
   could start below the sidebar, leaving a large empty region.
   
   This stylesheet forces:
   - sidebar fixed to the left
   - main content shifted right with margin-left
   - full-height app shell behavior
   ============================================================ */

/* ============================================================
   Base Page Structure
   ============================================================ */
html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body.sec-app-body {
    background: #eef2f6;
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
    min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 180px;
    background: linear-gradient(180deg, #123f6d 0%, #0e4c84 100%);
    color: #fff;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.app-sidebar__brand {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.app-sidebar__brand-link {
    display: block;
    color: #fff;
    text-decoration: none;
    font-size: 29px;
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 8px;
}

.app-sidebar__brand-link:hover {
    color: #fff;
    text-decoration: none;
}

.app-sidebar__welcome {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.4;
}

.app-sidebar__nav {
    padding: 10px 0;
}

.app-sidebar__link {
    display: block;
    padding: 14px 18px;
    color: rgba(255, 255, 255, 0.96);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.app-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    text-decoration: none;
}

.app-sidebar__link.is-active {
    background: rgba(255, 255, 255, 0.12);
    border-left-color: #ffffff;
    font-weight: 700;
}

/* ============================================================
   Main Content Area
   ============================================================ */
.app-main {
    margin-left: 180px;
    min-height: 100vh;
    padding: 24px;
    box-sizing: border-box;
}

.app-main__inner {
    max-width: 1400px;
}

/* ============================================================
   Page Content
   ============================================================ */
.page-content {
    margin: 0;
    padding: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-header h1 {
    margin: 0 0 8px;
    font-size: 22px;
    line-height: 1.2;
    color: #1f2937;
}

.page-header p {
    margin: 0;
    color: #4b5563;
    font-size: 14px;
}

/* ============================================================
   Card Normalization
   ============================================================ */
.card {
    background: #fff;
    border: 1px solid #d8e0ea;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04);
    overflow: hidden;
}

.card + .card {
    margin-top: 18px;
}

.card-body {
    padding: 18px 16px;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.table th {
    background: #f8fafc;
    font-weight: 700;
    color: #1f2937;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    padding: 24px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #475569;
}

/* ============================================================
   Form Helpers
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.form-group {
    display: block;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-control {
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================
   Buttons - basic fallback styling
   ============================================================ */
.btn {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.btn-primary {
    background: #0f4c81;
    color: #fff;
    border-color: #0f4c81;
}

.btn-primary:hover {
    background: #0d406d;
    color: #fff;
}

.btn-secondary {
    background: #e9eef5;
    color: #1f2937;
    border-color: #cbd5e1;
}

.btn-secondary:hover {
    background: #dde6ef;
    color: #111827;
}

.btn-danger {
    background: #e63946;
    color: #fff;
    border-color: #e63946;
}

.btn-danger:hover {
    background: #cf2f3b;
    color: #fff;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991px) {
    .app-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        bottom: auto;
    }

    .app-main {
        margin-left: 0;
        padding: 18px;
    }

    .app-sidebar__brand-link {
        font-size: 22px;
    }
}