/* ── Reset ── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
html { height: 100%; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    background-image: url('../boxed-bg.png');
    background-repeat: repeat;
    background-attachment: fixed;
    color: #333;
    font-size: 15px;
    line-height: 1.5;
}

main {
    flex: 1 0 auto;
    padding: 1.5rem 0;
}

footer {
    background: #0961c9;
    color: white;
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

footer span { opacity: 0.9; }

a { color: #0961c9; text-decoration: none; }
a:hover { text-decoration: underline; }
/* ── Header ── */
header {
    background: #0961c9;
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

header h1 { font-size: 1.2rem; font-weight: bold; }

.header-logo { font-size: 1.2rem; font-weight: bold; color: white; text-decoration: none; margin-right: auto; }

header nav, .header-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

header nav a, .header-nav a {
    color: white;
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.35rem 0.85rem;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    transition: background 0.15s;
    white-space: nowrap;
}

header nav a:hover, .header-nav a:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
    text-decoration: none;
}

@media (max-width: 600px) {
    header { flex-direction: column; align-items: flex-start; }
    header h1, .header-logo { font-size: 1rem; }
    .header-nav { width: 100%; }
    .header-nav a { font-size: 0.8rem; padding: 0.3rem 0.65rem; }
}

/* ── Layout ── */
.container { padding: 1.5rem; margin: 0 auto; max-width: 960px; }

/* ── Auth pages ── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 1.3rem;
    font-weight: bold;
    color: #0961c9;
    margin-bottom: 0.4rem;
}

.auth-card p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.35rem;
    color: #444;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.45rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #0961c9;
    box-shadow: 0 0 0 2px rgba(9,97,201,0.15);
}

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

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
    text-decoration: none;
}

.btn-primary { background: #0961c9; color: white; }
.btn-primary:hover { background: #0750a8; text-decoration: none; color: white; }
.btn-primary:disabled { background: #6da3e0; cursor: not-allowed; }

.btn-secondary { background: #eee; color: #333; border: 1px solid #ccc; }
.btn-secondary:hover { background: #e0e0e0; text-decoration: none; }

.btn-block { width: 100%; text-align: center; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.85rem; }

/* ── Alerts ── */
.alert {
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: none;
}

.alert-error { background: #fce4e4; border: 1px solid #f5a0a0; color: #c00; }
.alert-success { background: #e4f7ec; border: 1px solid #a0d4b5; color: #1a6b3a; }

/* ── Cards ── */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.card-title { font-weight: bold; font-size: 0.95rem; color: #222; }
.card-meta { font-size: 0.8rem; color: #888; margin-top: 0.25rem; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: bold;
}

.badge-open { background: #dbeafe; color: #1e40af; }
.badge-inprogress { background: #fef3c7; color: #92400e; }
.badge-awaiting { background: #ede9fe; color: #5b21b6; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-closed { background: #eee; color: #555; }

.badge-low { background: #eee; color: #555; }
.badge-normal { background: #dbeafe; color: #1e40af; }
.badge-high { background: #fef3c7; color: #92400e; }
.badge-critical { background: #fee2e2; color: #991b1b; }

/* ── Ticket thread ── */
.note {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.note-customer { background: #eef4fc; border: 1px solid #c2d9f5; }
.note-staff { background: white; border: 1px solid #ddd; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.note-system { background: #f4f4f4; border: 1px solid #ddd; color: #888; font-size: 0.82rem; }

.note-meta {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 0.4rem;
    font-weight: bold;
}

.note-text { white-space: pre-wrap; line-height: 1.6; }

/* ── Page title row ── */
.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.page-title { font-size: 1.2rem; font-weight: bold; color: #222; }

/* ── Filter bar ── */
.filter-bar {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-bar select { width: auto; display: inline-block; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

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

/* ── Ticket detail meta ── */
.ticket-meta {
    font-size: 0.82rem;
    color: #888;
    margin-bottom: 1.25rem;
}

.ticket-badges {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.ticket-ref {
    font-size: 0.85rem;
    color: #888;
}

/* ── Section label ── */
.section-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* ── Back link ── */
.back-link {
    display: inline-block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
    text-decoration: none;
}

.back-link:hover { color: #0961c9; text-decoration: none; }
