/* ============================================================
   assets/css/style.css — Mad Town Print Job Tracker
   Design: clean utility, red/dark/neutral palette
   ============================================================ */

/* -- Reset / Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --red:       #C0281C;
    --red-dark:  #8F1D14;
    --red-light: #FDECEA;
    --dark:      #1A1A1A;
    --mid:       #444444;
    --muted:     #717171;
    --border:    #DDDDDD;
    --bg:        #F5F5F3;
    --white:     #FFFFFF;
    --cream:     #FAFAF8;

    /* status badge colors */
    --s-new:        #0057B8;
    --s-quoted:     #7B4FBF;
    --s-approved:   #2E7D32;
    --s-design:     #E65C00;
    --s-production: #C0281C;
    --s-waiting:    #B45309;
    --s-completed:  #2E7D32;
    --s-invoiced:   #1565C0;
    --s-paid:       #1B5E20;

    --radius:  6px;
    --shadow:  0 1px 4px rgba(0,0,0,0.08);
}

html { font-size: 15px; }
body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.5;
    min-height: 100vh;
}

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

/* -- Layout ----------------------------------------------- */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* -- Sidebar Nav ------------------------------------------ */
.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--dark);
    color: #eee;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid #333;
}

.sidebar-logo .app-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.sidebar-logo .app-sub {
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.sidebar nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar nav a {
    display: block;
    padding: 10px 20px;
    color: #ccc;
    font-size: 0.88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    text-decoration: none;
}

.sidebar nav a:hover {
    background: #2a2a2a;
    color: var(--white);
}

.sidebar nav a.active {
    background: #2a2a2a;
    border-left-color: var(--red);
    color: var(--white);
}

.sidebar nav .nav-section {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #555;
    padding: 16px 20px 4px;
}

/* -- Main content area ------------------------------------ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
}

.content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

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

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

.card-header h2 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
}

.card-body {
    padding: 20px;
}

/* -- Stat boxes ------------------------------------------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.stat-box .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--dark);
}

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

.stat-box.danger .stat-value { color: var(--red); }
.stat-box.warning .stat-value { color: #B45309; }
.stat-box.success .stat-value { color: #2E7D32; }

/* -- Tables ----------------------------------------------- */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #F0F0EE;
    vertical-align: middle;
}

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

tbody tr:hover { background: var(--cream); }

tbody tr.overdue td { background: #FFF5F5; }
tbody tr.due-today td { background: #FFFBF0; }

/* -- Badges ----------------------------------------------- */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-new        { background: #E8F0FD; color: var(--s-new); }
.badge-quoted     { background: #F3EEF9; color: var(--s-quoted); }
.badge-approved   { background: #E8F5E9; color: var(--s-approved); }
.badge-design     { background: #FFF3E0; color: var(--s-design); }
.badge-production { background: #FDECEA; color: var(--s-production); }
.badge-waiting    { background: #FEF3C7; color: var(--s-waiting); }
.badge-completed  { background: #E8F5E9; color: var(--s-completed); }
.badge-invoiced   { background: #E3F0FF; color: var(--s-invoiced); }
.badge-paid       { background: #E8F5E9; color: var(--s-paid); }
.badge-default    { background: #F0F0EE; color: var(--muted); }

/* Priority dots */
.priority-dot {
    display: inline-block;
    width: 9px; height: 9px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}
.priority-1 { background: #A8B4BE; }
.priority-2 { background: #4A90D9; }
.priority-3 { background: #E67E22; }
.priority-4 { background: var(--red); }

/* -- Buttons ---------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.btn-primary:hover {
    background: var(--red-dark);
    border-color: var(--red-dark);
    text-decoration: none;
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--mid);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--bg);
    text-decoration: none;
    color: var(--dark);
}

.btn-danger {
    background: var(--white);
    color: var(--red);
    border-color: #EFC0BC;
}
.btn-danger:hover {
    background: var(--red-light);
    text-decoration: none;
    color: var(--red-dark);
}

.btn-sm { padding: 5px 11px; font-size: 0.78rem; }

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

label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--mid);
    margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    transition: border-color 0.15s;
    appearance: none;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(192,40,28,0.1);
}

textarea { resize: vertical; min-height: 90px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

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

/* -- Flash messages --------------------------------------- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.88rem;
    font-weight: 500;
}

.flash-success { background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; }
.flash-error   { background: #FDECEA; color: var(--red-dark); border: 1px solid #FFCDD2; }
.flash-info    { background: #E3F0FF; color: #1565C0; border: 1px solid #BBDEFB; }

/* -- Empty states ----------------------------------------- */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-state p { font-size: 0.9rem; margin-top: 8px; }

/* -- Profit cell ------------------------------------------ */
.profit-pos { color: #2E7D32; font-weight: 600; }
.profit-neg { color: var(--red); font-weight: 600; }

/* -- Responsive ------------------------------------------- */
@media (max-width: 760px) {
    .sidebar { display: none; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .content { padding: 16px; }
}
