/* ********************************************
   File: style.css
   Last Updated: 2026-02-02 PM
   ******************************************** */

/* ================= RESET ================= */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ================= PAGE WRAPPER ================= */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ================= HEADER ================= */
header {
    height: 168px;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-sizing: border-box;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.brand-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.brand-title .name {
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 900px;
}

.brand-title .subtitle {
    font-size: 14px;
    color: #cbd5e1;
    margin-top: 4px;
}

.header-right {
    font-size: 13px;
    color: #cbd5e1;
    white-space: nowrap;
}

.logo {
    width: 102px;
    height: 102px;
    flex: 0 0 auto;
}

/* ================= LAYOUT ================= */
.app-container {
    display: flex;
    flex: 1;
}

/* ================= SIDEBAR ================= */
.sidebar {
    width: 240px;
    background: #111827;
    color: #e5e7eb;
    padding-top: 8px;
    border-right: 1px solid #1f2937;
}

.nav-section {
    margin-bottom: 4px;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.nav-header:hover {
    background: #1f2937;
}

.nav-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
    width: 12px;
    text-align: center;
}

.nav-section.expanded .nav-arrow {
    transform: rotate(90deg);
}

.nav-children {
    display: none;
    padding-left: 20px;
}

.nav-section.expanded .nav-children {
    display: block;
}

.nav-item-single {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #1f2937;
    margin-bottom: 4px;
}

.nav-item-single:hover {
    background: #1f2937;
    text-decoration: none;
}

.nav-item-single.active {
    background: #0b1220;
    border-left: 3px solid #93c5fd;
    padding-left: 13px;
}

.nav-icon {
    font-size: 14px;
}

.menu-item {
    display: block;
    padding: 10px 16px 10px 24px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 13px;
}

.menu-item:hover {
    background: #1f2937;
    color: #e5e7eb;
    text-decoration: none;
}

.menu-item.active {
    background: #0b1220;
    border-left: 3px solid #93c5fd;
    padding-left: 21px;
    color: #e5e7eb;
}

/* ================= MAIN CONTENT ================= */
.main-content {
    flex: 1;
    padding: 22px;
    overflow-y: auto;
}

/* ================= FOOTER ================= */
footer {
    height: 48px;
    background: #111827;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border-top: 1px solid #1f2937;
}

/* ================= PAGE TITLE ================= */
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ================= CARDS ================= */
.card {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    max-width: 1100px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

/* ================= SECTION TITLES ================= */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 28px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #e5e7eb;
}

.section-title:first-of-type {
    margin-top: 10px;
}

/* ================= TYPOGRAPHY ================= */
.muted {
    color: #6b7280;
    font-size: 13px;
}

/* ================= FORMS ================= */
label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 10px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147,197,253,0.3);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ================= GRID LAYOUTS ================= */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

.grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 14px;
}

/* ================= BUTTONS ================= */
.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

button,
.btn {
    background: #0f172a;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

button:hover,
.btn:hover {
    opacity: 0.92;
    text-decoration: none;
}

.btn-secondary {
    background: #374151;
}

.btn-link {
    background: #6b7280;
    color: white;
}

.btn-new {
    font-size: 14px;
    background: #0f172a;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
}

.btn-danger {
    background: #dc2626;
}

/* ================= ALERTS ================= */
.alert-ok,
.alert-err {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.alert-ok {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-err {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ================= CHECKBOXES ================= */
.checkbox-group {
    display: flex;
    gap: 20px;
    align-items: center;
    padding-top: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* ================= DATA TABLES ================= */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 12px 10px;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    color: #374151;
    font-weight: 600;
}

.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.data-table tbody tr {
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: #f3f4f6;
}

/* ================= BADGES ================= */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge-lg {
    display: inline-block;
    padding: 6px 14px;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
}

/* ================= INFO GRID (for detail views) ================= */
.info-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 12px;
}

.info-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.info-value {
    font-size: 14px;
    color: #111827;
}

/* ================= CONTACT BLOCKS ================= */
.contact-block {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.contact-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.contact-role {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.contact-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.contact-detail {
    font-size: 13px;
    color: #4b5563;
}

.our-client {
    color: #059669;
    font-weight: 700;
}

/* ================= MATTER VIEW LAYOUT ================= */
.matter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.matter-col .card {
    margin-bottom: 20px;
}

/* ================= DIVIDERS ================= */
.divider {
    margin: 18px 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

/* ================= LOOKUP TABLE EDIT ================= */
.lookup-table .inline-input {
    padding: 6px 8px;
    font-size: 13px;
}

.lookup-table td {
    vertical-align: middle;
}

.lookup-table tr.inactive-row {
    opacity: 0.5;
    background: #f9fafb;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    background: #374151;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-small:hover {
    opacity: 0.9;
}

/* ================= CLIENT SEARCH ================= */
.client-search-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.client-search {
    width: 100%;
}

.client-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.client-result {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.client-result:last-child {
    border-bottom: none;
}

.client-result:hover {
    background: #f3f4f6;
}

.client-result-name {
    font-weight: 600;
    color: #111827;
}

.client-result-detail {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.no-results {
    padding: 12px;
    color: #6b7280;
    font-style: italic;
}

/* ================= SEARCH FORM ================= */
.search-form {
    margin-bottom: 0;
}

/* ================= BORROWER BLOCKS ================= */
.borrower-block {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.borrower-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.borrower-label {
    font-size: 14px;
    font-weight: 700;
    color: #1e3a5f;
}

.btn-remove {
    font-size: 12px;
    color: #dc2626;
    background: none;
    border: 1px solid #dc2626;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-remove:hover {
    background: #fee2e2;
}

/* ================= SESSION LOG ================= */
.session-log-list {
    max-height: 70vh;
    overflow-y: auto;
}

.session-date-header {
    font-size: 14px;
    font-weight: 700;
    color: #1e3a5f;
    padding: 16px 0 8px 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 12px;
    position: sticky;
    top: 0;
    background: white;
}

.session-date-header:first-child {
    padding-top: 0;
}

.session-log-item {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.session-log-item:last-child {
    border-bottom: none;
}

.session-log-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.session-category {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    background: #e5e7eb;
    color: #374151;
}

.session-category-feature {
    background: #dbeafe;
    color: #1e40af;
}

.session-category-bugfix {
    background: #fee2e2;
    color: #991b1b;
}

.session-category-ui {
    background: #fef3c7;
    color: #92400e;
}

.session-category-database {
    background: #d1fae5;
    color: #065f46;
}

.session-category-security {
    background: #ede9fe;
    color: #5b21b6;
}

.session-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.session-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.action-link {
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
}

.action-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.action-link-btn {
    font-size: 12px;
    color: #6b7280;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.action-link-btn:hover {
    color: #dc2626;
    text-decoration: underline;
}

.inline-form {
    display: inline;
}

.session-description {
    font-size: 13px;
    color: #4b5563;
    margin-top: 6px;
    line-height: 1.5;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .matter-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 200px;
    }
}

@media (max-width: 600px) {
    header {
        height: auto;
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .logo {
        width: 60px;
        height: 60px;
    }
    
    .brand-title .name {
        font-size: 16px;
    }
    
    .sidebar {
        display: none;
    }
    
    .main-content {
        padding: 14px;
    }
}

/* ============================================
   CLOSING DETAILS PAGE
   ============================================ */

/* Tabs */
.tab-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 16px;
    border-bottom: 2px solid #1a365d;
}
.tab-btn {
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-bottom: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px 6px 0 0;
    color: #555;
}
.tab-btn:hover { background: #e8e8e8; }
.tab-btn.active {
    background: #1a365d;
    color: #fff;
    border-color: #1a365d;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Form layout */
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 24px;
}
.form-group label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; }
.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
.form-group input:focus {
    border-color: #1a365d;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26,54,93,0.15);
}

/* Cost grid */
.cost-section { margin-bottom: 20px; }
.cost-section-header {
    font-weight: 600;
    font-size: 14px;
    padding: 8px 12px;
    background: #1a365d;
    color: #fff;
    margin-bottom: 0;
}
.cost-grid-wrapper { overflow-x: auto; }
.cost-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.cost-grid th {
    background: #e8ecf1;
    padding: 6px 4px;
    font-weight: 600;
    font-size: 11px;
    text-align: center;
    border: 1px solid #ccc;
}
.cost-grid td {
    padding: 2px;
    border: 1px solid #ddd;
}
.cost-grid .cost-line-num {
    width: 32px;
    text-align: center;
    color: #888;
    font-size: 11px;
}
.cost-grid .cost-desc { min-width: 200px; }
.cost-grid .cost-desc input {
    width: 100%;
    border: none;
    padding: 4px 6px;
    font-size: 13px;
    box-sizing: border-box;
}
.cost-grid .cost-amt {
    width: 100px;
    text-align: right;
}
.cost-grid .cost-amt input {
    width: 100%;
    border: none;
    padding: 4px 6px;
    font-size: 13px;
    text-align: right;
    box-sizing: border-box;
}
.cost-grid input:focus {
    background: #fffde7;
    outline: 1px solid #1a365d;
}
.cost-grid tr:hover { background: #f8f9fa; }
.cost-grid tr:nth-child(even) { background: #fafafa; }
.cost-grid tr:nth-child(even):hover { background: #f0f4f8; }

/* ********************************************
   END OF FILE
   ******************************************** */