/* assets/style.css — WebWare Client DB */
/* Aesthetic: Industrial/utilitarian — dark navy, slate, amber accent, monospace details */

/* ================================================================
   CSS VARIABLES
   ================================================================ */
:root {
    --bg:           #0f1117;
    --bg-card:      #181c27;
    --bg-input:     #1e2333;
    --bg-hover:     #232840;
    --border:       #2a3048;
    --border-light: #333d5c;

    --text:         #e2e8f0;
    --text-muted:   #7a8aaa;
    --text-dim:     #4a5568;

    --accent:       #f59e0b;
    --accent-dim:   #92620a;
    --accent-hover: #fbbf24;

    --green:        #10b981;
    --red:          #ef4444;
    --blue:         #3b82f6;
    --yellow:       #f59e0b;

    --font-sans:  'IBM Plex Sans', sans-serif;
    --font-mono:  'IBM Plex Mono', monospace;

    --radius:     6px;
    --radius-lg:  10px;
    --shadow:     0 4px 24px rgba(0,0,0,0.4);
    --transition: 0.15s ease;
}

/* ================================================================
   RESET & BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

.mono { font-family: var(--font-mono); font-size: 0.85em; }
.muted { color: var(--text-muted); }

/* ================================================================
   LAYOUT
   ================================================================ */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ================================================================
   HEADER / NAV
   ================================================================ */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-mark {
    background: var(--accent);
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 3px;
    letter-spacing: 0.05em;
}

.brand-name { font-size: 0.95rem; }
.brand-sub  { color: var(--text-muted); font-weight: 300; }

.main-nav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    transition: var(--transition);
    text-decoration: none;
}

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

.nav-link.active { color: var(--accent); }

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-badge {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.btn-logout {
    font-size: 0.82rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    transition: var(--transition);
    text-decoration: none;
}

.btn-logout:hover {
    color: var(--red);
    border-color: var(--red);
}

/* ================================================================
   FOOTER
   ================================================================ */
.app-footer {
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(245,158,11,0.06) 0%, transparent 60%),
        var(--bg);
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-mark {
    display: inline-block;
    background: var(--accent);
    color: #000;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 5px;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.login-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
}

.login-title span { color: var(--text-muted); font-weight: 300; }

.login-sub {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
    margin-top: 0.25rem;
}

.login-form { display: flex; flex-direction: column; gap: 1.25rem; }

/* ================================================================
   FORMS
   ================================================================ */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.field-group input,
.field-group select,
.field-group textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    transition: border-color var(--transition);
    width: 100%;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.field-group textarea { resize: vertical; min-height: 80px; }

.field-group input[type="checkbox"] {
    width: auto;
    accent-color: var(--accent);
}

/* Password reveal field */
.password-field-wrap {
    position: relative;
}

.password-field-wrap input {
    padding-right: 2.5rem;
    font-family: var(--font-mono);
}

.btn-reveal {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    transition: color var(--transition);
    line-height: 1;
}

.btn-reveal:hover { color: var(--accent); }
.btn-reveal svg   { width: 16px; height: 16px; display: block; }

.btn-reveal-input {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    transition: color var(--transition);
    line-height: 1;
}

.btn-reveal-input:hover { color: var(--accent); }
.btn-reveal-input svg   { width: 16px; height: 16px; display: block; }

.credential-display {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg);
    border-color: var(--border);
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* Form grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-grid .span-2 { grid-column: 1 / -1; }

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: 1; }
}

.form-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.form-section-title {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.25rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-primary {
    background: var(--accent);
    color: #000;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn-primary:hover { background: var(--accent-hover); color: #000; }
.btn-full { width: 100%; }

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
}

.btn-outline:hover {
    color: var(--text);
    border-color: var(--border-light);
}

.btn-danger {
    background: transparent;
    color: var(--red);
    font-size: 0.88rem;
    padding: 0.5rem 1.1rem;
    border: 1px solid var(--red);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    text-decoration: none;
}

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

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    border-left: 3px solid;
}

.alert-error   { background: rgba(239,68,68,0.1);  border-color: var(--red);    color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: var(--yellow); color: #fcd34d; }
.alert-success { background: rgba(16,185,129,0.1); border-color: var(--green);  color: #6ee7b7; }

/* ================================================================
   DASHBOARD
   ================================================================ */
.dashboard-wrap { max-width: 900px; margin: 0 auto; }

.search-hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.search-hero h1 {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.search-hero p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.search-form { width: 100%; }

.search-input-wrap {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    gap: 0.75rem;
    transition: border-color var(--transition);
}

.search-input-wrap:focus-within { border-color: var(--accent); }

.search-icon { width: 18px; height: 18px; color: var(--text-dim); flex-shrink: 0; }

.search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder { color: var(--text-dim); }

/* Stats */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

@media (max-width: 700px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    text-decoration: none;
    transition: border-color var(--transition), transform var(--transition);
    display: block;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-card--alert { border-color: var(--accent-dim); }
.stat-card--alert .stat-number { color: var(--accent); }

.stat-number {
    font-size: 2.2rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.4rem;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quick-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.quick-label {
    font-size: 0.82rem;
    color: var(--text-dim);
    font-family: var(--font-mono);
}

/* Search results */
.results-wrap { margin-top: 1.5rem; }

.results-header {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.results-header strong { color: var(--text); }

.clear-search {
    font-size: 0.82rem;
    color: var(--text-dim);
    text-decoration: none;
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: var(--radius);
}

.result-section { margin-bottom: 2.5rem; }

.result-section-title {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
    font-size: 0.9rem;
}

/* ================================================================
   DATA TABLES
   ================================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--bg-hover); }

.table-link {
    color: var(--text-muted);
    font-size: 0.82rem;
    white-space: nowrap;
    transition: color var(--transition);
    text-decoration: none;
}

.table-link:hover { color: var(--accent); }

/* Page header row above tables */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 500;
}

/* ================================================================
   DETAIL / VIEW PAGE
   ================================================================ */
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.detail-card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.detail-card-title {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.detail-field {
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.detail-field:nth-child(odd) { border-right: 1px solid var(--border); }
.detail-field:last-child,
.detail-field:nth-last-child(2):nth-child(odd) { border-bottom: none; }

.detail-field-label {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin-bottom: 0.2rem;
}

.detail-field-value {
    font-size: 0.92rem;
    color: var(--text);
}

.detail-field-value.mono { font-family: var(--font-mono); font-size: 0.82rem; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge--active  { background: rgba(16,185,129,0.15); color: var(--green); }
.badge--inactive{ background: rgba(239,68,68,0.15);  color: var(--red);   }
.badge--pending { background: rgba(245,158,11,0.15); color: var(--yellow);}
.badge--yes     { background: rgba(59,130,246,0.15); color: var(--blue);  }
.badge--no      { background: rgba(74,85,104,0.2);   color: var(--text-muted); }

/* ================================================================
   MISC COMPONENTS
   ================================================================ */
.count-badge {
    font-size: 0.7em;
    background: var(--bg-hover);
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 2px 8px;
    border-radius: 20px;
    vertical-align: middle;
    border: 1px solid var(--border);
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.centered { text-align: center; }

.actions-cell {
    display: flex;
    gap: 0.75rem;
    white-space: nowrap;
}

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.filter-bar { margin-bottom: 1.25rem; }

.filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius);
    flex: 1;
    min-width: 200px;
    transition: border-color var(--transition);
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius);
}

.sort-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: inherit;
    white-space: nowrap;
    transition: color var(--transition);
}

.sort-link:hover,
.sort-link.sort-active { color: var(--accent); }

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 860px;
}

.required { color: var(--red); }

.field-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg) !important;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    padding-top: 1.8rem;
}

.span-2 { grid-column: 1 / -1; }

.danger-zone {
    margin-top: 2rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--radius-lg);
    background: rgba(239,68,68,0.05);
}

.danger-zone-title {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--red);
    margin-bottom: 0.5rem;
}

.danger-zone p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ================================================================
   INVOICE-SPECIFIC
   ================================================================ */
.totals-bar {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.total-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.total-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-dim);
}

.total-value {
    font-size: 1.1rem;
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text);
}

.total-value--green { color: var(--green); }
.total-value--amber { color: var(--accent); }

.row-overdue td  { background: rgba(239,68,68,0.04); }
.row-upcoming td { background: rgba(245,158,11,0.04); }

/* ================================================================
   BREADCRUMB
   ================================================================ */
.breadcrumb {
    font-size: 0.82rem;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--text-dim); }
