/* The PaperMaster Company — AI Operations Platform
   Brand colors sourced from thepapermaster.net
   To rebrand: change ONLY the :root variables below */
:root {
    --primary: #294a70;          /* TPM navy blue — headings, sidebar, header */
    --primary-dark: #1e3a5c;     /* Darker navy for hover states */
    --accent: #ffab1f;           /* TPM amber/orange — buttons, highlights */
    --accent-hover: #f4a024;     /* Darker amber for hover */
    --text: #333333;             /* Body text */
    --text-light: #666666;       /* Secondary text */
    --text-muted: #999999;       /* Muted/disabled text */
    --bg: #f5f5f5;               /* Page background */
    --white: #ffffff;
    --border: #dddddd;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #275FAC;             /* TPM bright blue */
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1);
    --font: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-heading: 'Merriweather Sans', var(--font);
    --sidebar-width: 240px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Header */
header { 
    background: var(--primary); 
    color: #fff; 
    padding: .75rem 1.5rem; 
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}
.header-inner { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    max-width: none;
    gap: 1rem; 
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.brand { color: #fff; text-decoration: none; }
.brand h1 { font-size: 1.25rem; font-weight: 700; line-height: 1; }
.brand small { font-size: .75rem; opacity: .7; display: block; }

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    padding: .25rem;
}

/* User info */
.user-info { 
    display: flex; 
    align-items: center; 
    gap: .75rem; 
    color: rgba(255,255,255,.8); 
    font-size: .875rem; 
}
.user-link { color: #fff; font-weight: 500; }
.user-role { 
    background: rgba(255,255,255,.15); 
    padding: .2rem .5rem; 
    border-radius: 3px; 
    font-size: .75rem; 
}

/* Sidebar Navigation */
.nav-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - 64px);
    background: var(--primary);
    padding: 1rem 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform .3s ease;
}
.nav-item {
    display: block;
    color: rgba(255,255,255,.8);
    padding: .75rem 1.5rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all .2s ease;
}
.nav-item:hover {
    background: rgba(255,255,255,.1);
    color: #fff;
    border-left-color: var(--accent);
}
.nav-item.active {
    background: rgba(225,112,85,.15);
    color: #fff;
    border-left-color: var(--accent);
    font-weight: 500;
}
.nav-group {
    margin: 1rem 0;
}
.nav-group-label {
    color: rgba(255,255,255,.6);
    font-size: .75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .05em;
    padding: .5rem 1.5rem .25rem;
}
.nav-group .nav-item {
    padding-left: 2rem;
}

/* Main content */
main {
    margin-top: 64px;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 64px);
}
main.with-nav {
    margin-left: var(--sidebar-width);
}

/* Typography */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; margin-bottom: 1rem; color: var(--primary); }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
p { margin-bottom: .75rem; }

/* Alerts */
.alert {
    padding: .75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    border-left: 4px solid;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    animation: slideIn .3s ease;
}
.alert-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: .6;
    line-height: 1;
    padding: 0;
}
.alert-close:hover { opacity: 1; }
.alert-success { background: #ecfdf5; border-color: var(--success); color: #065f46; }
.alert-danger { background: #fef2f2; border-color: var(--danger); color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info { background: #eff6ff; border-color: var(--info); color: #1e40af; }

/* Buttons */
.btn {
    display: inline-block;
    padding: .625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s;
    font-family: var(--font);
    white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent); color: #fff; }
.btn-sm { padding: .375rem .75rem; font-size: .8rem; }
.btn-logout { background: rgba(255,255,255,.15); color: #fff; }
.btn-logout:hover:not(:disabled) { background: rgba(255,255,255,.25); }
.btn:not(.btn-primary):not(.btn-danger):not(.btn-outline):not(.btn-logout) {
    background: var(--border);
    color: var(--text);
}
.btn:not(.btn-primary):not(.btn-danger):not(.btn-outline):not(.btn-logout):hover:not(:disabled) {
    background: #d1d5db;
}

/* Cards */
.card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.card h3 { color: var(--primary); margin-bottom: .5rem; }
.card p { color: var(--text-light); font-size: .875rem; margin-bottom: 0; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
th {
    background: var(--primary);
    color: #fff;
    text-align: left;
    padding: .75rem;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 600;
}
td {
    padding: .75rem;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: #f1f5f9; }
tbody tr:last-child td { border-bottom: none; }

/* Forms */
label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: .5rem;
}
input[type="text"], input[type="password"], input[type="email"], input[type="number"], 
input[type="url"], input[type="tel"], select, textarea {
    width: 100%;
    padding: .625rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    font-family: var(--font);
    background: var(--white);
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(225,112,85,.2);
}
textarea { resize: vertical; min-height: 120px; }
input[type="checkbox"] {
    width: auto;
    margin-right: .5rem;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 64px);
    padding: 2rem 1rem;
}
.login-card {
    background: var(--white);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border-top: 4px solid var(--accent);
}
.login-card h2 {
    text-align: center;
    margin-bottom: .5rem;
}
.login-card .text-muted {
    text-align: center;
    margin-bottom: 2rem;
}
.login-card .btn {
    width: 100%;
    margin-top: 1rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: .25rem .5rem;
    border-radius: 3px;
    font-size: .75rem;
    font-weight: 500;
    line-height: 1;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
}

/* Pagination */
.pagination {
    display: flex;
    gap: .25rem;
    justify-content: center;
    margin: 2rem 0;
}
.page-link {
    padding: .5rem .75rem;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius);
}
.page-link:hover { background: var(--bg); }
.page-link.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Utilities */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }

/* Footer */
footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: .8rem;
}
footer.with-nav {
    margin-left: var(--sidebar-width);
}

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    .nav-sidebar {
        transform: translateX(-100%);
        z-index: 2000;
        box-shadow: var(--shadow-lg);
    }
    .nav-sidebar.open { transform: translateX(0); }
    main.with-nav { margin-left: 0; }
    footer.with-nav { margin-left: 0; }
    .header-inner { flex-wrap: wrap; }
    .card-grid { grid-template-columns: 1fr; }
    .modal { width: 95%; }
    table { font-size: .8rem; }
    th, td { padding: .5rem; }
}

/* Print */
@media print {
    .nav-sidebar, header, footer { display: none !important; }
    main.with-nav { margin-left: 0 !important; margin-top: 0 !important; }
    .alert, .btn { display: none !important; }
    * { background: white !important; color: black !important; }
}