/* Modern CSS System - LimOps */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Slate/Emerald Theme (Clean & Professional) */
    --primary: #0f172a;
    /* Slate 900 - Headings, Strong Text */
    --primary-light: #334155;
    /* Slate 700 - Body Text */
    --accent: #059669;
    /* Emerald 600 - Primary Actions/Links */
    --accent-hover: #047857;
    /* Emerald 700 */
    --accent-light: #d1fae5;
    /* Emerald 100 - Backgrounds/Badges */

    --bg-body: #f8fafc;
    /* Slate 50 - Main Background */
    --bg-card: #ffffff;
    /* White - Cards/Inputs */

    --border: #e2e8f0;
    /* Slate 200 - Borders */
    --border-focus: #10b981;
    /* Emerald 500 - Input Focus */

    --danger: #ef4444;
    /* Red 500 */
    --danger-bg: #fee2e2;
    /* Red 100 */

    /* Spacing & Layout */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --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);

    --container-width: 1100px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--primary-light);
    margin: 0;
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    color: var(--primary);
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.75em;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 1.85rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

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

/* Layout Components */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    color: var(--accent);
}

.nav-links a {
    color: var(--primary-light);
    margin-left: 2rem;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--accent);
}

/* Common UI Elements */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 1.5rem;
    /* Reduced padding for denser info */
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.btn,
button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    background-color: var(--accent);
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover,
button:hover,
.button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
    /* Force white for links styled as buttons */
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary-light);
}

.btn-outline:hover {
    background: var(--bg-body);
    color: var(--primary);
    transform: none;
    border-color: var(--primary-light);
}

/* Forms */
label {
    display: block;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    display: block;
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--primary);
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Tables */
table {
    width: 100%;
    border-spacing: 0;
    margin-bottom: 1rem;
}

th {
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--primary-light);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f1f5f9;
}

td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
}

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

tr:hover td {
    background-color: #f8fafc;
}

/* Dashboard Specifics */
.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* Quote Form Specifics */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.section-header h3 {
    margin: 0;
}

.section-header button {
    /* Small add button */
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background-color: var(--bg-body);
    color: var(--primary);
    border: 1px solid var(--border);
}

.form-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
    background: #fff;
    padding: 0.5rem;
    border: 1px solid transparent;
    /* invisible border usually */
}

.form-row:hover {
    background: #f8fafc;
    border-radius: var(--radius-sm);
}

/* Adjust input widths in rows */
.w-100 {
    width: 100px !important;
    flex-shrink: 0;
}

.w-150 {
    width: 150px !important;
    flex-shrink: 0;
}

.flex-grow {
    flex-grow: 1;
}

button.remove-row {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 0.4rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

button.remove-row:hover {
    background: var(--danger);
    color: white;
}

/* Totals Box */
.totals-card {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    text-align: right;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-top: 2rem;
}

.totals-card div {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.totals-card .final-total {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

/* Login Page Specifics (Integrated) */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    background: var(--accent);
    color: white;
    font-size: 1.75rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.4);
}

.login-title {
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.login-subtitle {
    color: var(--primary-light);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.login-form {
    text-align: left;
}

.login-form .btn-login {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
    margin-top: 1rem;
}

.login-form .label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.login-form a.forgot-password {
    font-size: 0.85rem;
    color: var(--primary-light);
}

.login-form a.forgot-password:hover {
    color: var(--accent);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 500;
}

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

/* CSS Updates for UI Polish */

/* Green Section Headers */
.section-header {
    border-bottom: 2px solid #0f4c3a;
    /* LimOps Green */
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.section-header h3 {
    color: #0f4c3a;
    font-size: 1.1rem;
    text-transform: uppercase;
    font-weight: 700;
}

/* Table Headers for Form */
.form-table-header {
    display: flex;
    gap: 10px;
    padding: 0 10px 5px 10px;
    margin-bottom: 5px;
    color: #0f4c3a;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.form-table-header .flex-grow {
    flex: 1;
}

.form-table-header .w-100 {
    width: 80px;
    flex-shrink: 0;
}

.form-table-header .w-150 {
    width: 120px;
    flex-shrink: 0;
}

/* Small buttons */
.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border: 1px solid #0f4c3a;
    color: #0f4c3a;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: #0f4c3a;
    color: white;
}

/* Fix Login Logo Sizing */

.login-logo-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
}

/* Fix Quote Creation Form Rows */
/* Fix Quote Creation Form Rows - CSS GRID IMPLEMENTATION */
.quote-grid-header,
.form-row {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) 80px 120px 80px 40px;
    gap: 15px;
    align-items: end;
    padding: 10px;
    min-width: 650px;
    /* Force one line */
}

.quote-grid-header {
    background-color: #f1f5f9;
    border-bottom: 2px solid #0f4c3a;
    color: #0f4c3a;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.form-row {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
    align-items: end;
    /* Align inputs to bottom */
}

/* Helpers inside grid */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Ensure inputs fill their grid cells */
.form-row input,
.form-row select,
.form-row .flex-grow {
    width: 100%;
}

/* Remove old width overrides since grid handles it */
.form-row .w-100 {
    width: 100% !important;
}

.form-row .w-150 {
    width: 100% !important;
}

/* Styles for the catalog select which sits above the name input */
.flex-grow {
    display: flex;
    flex-direction: column;
}

.catalog-select {
    margin-bottom: 5px !important;
    font-size: 0.85rem;
    color: #64748b;
    border-color: transparent;
    background: #f8fafc;
}

.catalog-select:hover {
    border-color: #cbd5e1;
}

button.remove-row {
    height: 38px;
    width: 100%;
    margin-bottom: 1px;
}

.form-group label {
    margin-bottom: 0.3rem;
    color: #334155;
    text-align: left;
}

.login-title {
    font-size: 1.5rem;
    color: #0f172a;
    margin-bottom: 1.5rem;
}