/* =========================================================
   Global Reset & Base
   ========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
                 Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
    background-color: #f3f4f6;
}

/* Basic elements */

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5rem;
    font-weight: 600;
    color: #0f172a;
}

p {
    margin: 0 0 0.75rem;
}

a {
    color: #0f3b66;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Utility */

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.text-muted {
    color: #9ca3af;
}

/* =========================================================
   Layout Shell
   ========================================================= */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background-color: #0f3b66;
    color: #f9fafb;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.app-header__brand {
    font-size: 1.1rem;
    font-weight: 600;
}

.app-header__subtitle {
    font-size: 0.8rem;
    color: #d1d5db;
}

.app-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.app-header__brand-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.company-logo {
    height: 40px;
    width: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
    padding: 2px;
}

.app-header__brand-text {
    display: flex;
    flex-direction: column;
}



.app-main {
    flex: 1 0 auto;
    padding: 1.25rem 0.75rem;
}

.app-container {
    max-width: 1100px;
    margin: 0 auto;
}

/* Footer */

.app-footer {
    flex-shrink: 0;
    padding: 0.6rem 1.25rem;
    background-color: #0f3b66;
    color: #e5e7eb;
    font-size: 0.8rem;
    text-align: center;
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    line-height: 1.25;
    font-weight: 500;
    cursor: pointer;
    background-color: transparent;
    color: #111827;
    text-decoration: none;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #0f3b66;
    border-color: #0f3b66;
    color: #f9fafb;
}
.btn-primary:hover {
    background-color: #0b2947;
    border-color: #0b2947;
}

.btn-outline-light {
    border-color: #e5e7eb;
    color: #f9fafb;
    background-color: transparent;
}
.btn-outline-light:hover {
    background-color: rgba(15, 23, 42, 0.18);
    border-color: #e5e7eb;
}

/* =========================================================
   Cards
   ========================================================= */

.card {
    background-color: #ffffff;
    border-radius: 0.9rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    padding: 0;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.card__header {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
}

.card__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111827;
}

.card__subtitle {
    font-size: 0.8rem;
    color: #6b7280;
}

.card > form,
.card > .card__body,
.card > .table-wrapper,
.card > .p-3 {
    padding: 0.9rem 1rem 1rem;
}

/* Simple padding helper for cards */
.p-3 {
    padding: 0.9rem 1rem;
}

/* =========================================================
   Forms
   ========================================================= */

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: #374151;
}

.form-control,
textarea,
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="url"] {
    display: block;
    width: 100%;
    padding: 0.4rem 0.55rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 0.86rem;
    line-height: 1.4;
    background-color: #ffffff;
    color: #111827;
    outline: none;
}

.form-control--sm {
    padding: 0.25rem 0.45rem;
    font-size: 0.8rem;
}

.form-control:focus,
textarea:focus,
select:focus,
input:focus {
    border-color: #0f3b66;
    box-shadow: 0 0 0 1px rgba(15, 59, 102, 0.2);
}

textarea {
    resize: vertical;
}

/* Form grid for two-column layouts */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.form-grid__col {
    min-width: 0;
}

@media (max-width: 720px) {
    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================
   Alerts
   ========================================================= */

.alert {
    border-radius: 0.6rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.alert-success {
    background-color: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-danger {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* =========================================================
   Tables
   ========================================================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

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

.table thead {
    background-color: #f3f4f6;
}

.table thead th {
    text-align: left;
    padding: 0.5rem 0.55rem;
    font-weight: 600;
    color: #4b5563;
    border-bottom: 1px solid #e5e7eb;
}

.table tbody td {
    padding: 0.45rem 0.55rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.table tbody tr:hover {
    background-color: #e5f0fa;
}

/* Inline form inside table cell (for status dropdown + button) */
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* =========================================================
   Auth / Login Pages
   ========================================================= */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f3b66 0%, #1d4f7b 40%, #e5e7eb 100%);
    padding: 1.5rem 0.75rem;
}

.auth-card {
    background-color: #ffffff;
    border-radius: 1rem;
    max-width: 430px;
    width: 100%;
    padding: 1.5rem 1.75rem 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}

.auth-card__title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.auth-card__subtitle {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

/* =========================================================
   Dashboard Stats
   ========================================================= */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.stat-card__label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.stat-card__value {
    font-size: 1.4rem;
    font-weight: 600;
    color: #0f172a;
}

.stat-card__hint {
    font-size: 0.78rem;
    color: #94a3b8;
}

/* =========================================================
   Weekly Calendar
   ========================================================= */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
}

@media (max-width: 900px) {
    .calendar-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.calendar-day {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 0.6rem 0.7rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.calendar-day__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
}

.calendar-day__dow {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.calendar-day__date {
    font-size: 0.85rem;
    font-weight: 500;
    color: #0f172a;
}

.calendar-day--today {
    border: 1px solid #0f3b66;
}

.calendar-day__empty {
    font-size: 0.78rem;
    margin-top: 0.3rem;
}

.calendar-day__events {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.3rem;
}

/* Event pill + tooltip */

.calendar-badge {
    position: relative;
    background: #0f3b66;
    color: #ffffff;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: default;
    max-width: 100%;
    overflow: hidden;
}

.calendar-badge__time {
    font-weight: 600;
}

.calendar-badge__title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-badge__status {
    font-size: 0.7rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.25);
}

/* Status colour badges */
.calendar-badge__status--draft       { background: #e0f2fe; color: #0369a1; }
.calendar-badge__status--confirmed   { background: #dcfce7; color: #15803d; }
.calendar-badge__status--dispatched  { background: #fef9c3; color: #854d0e; }
.calendar-badge__status--completed   { background: #e5e7eb; color: #111827; }
.calendar-badge__status--cancelled   { background: #fee2e2; color: #b91c1c; }

/* Simple tooltip on hover using data-tooltip attribute */

.calendar-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: 110%;
    transform: translateX(-50%);
    white-space: pre-line;
    background: #0f172a;
    color: #f9fafb;
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.3);
    opacity: 0;
    pointer-events: none;
    max-width: 230px;
    z-index: 20;
    transition: opacity 0.15s ease;
}

.calendar-badge:hover::after {
    opacity: 1;
}

/* =========================================================
   Miscellaneous
   ========================================================= */

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

@media (max-width: 640px) {
    .app-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .app-header__actions {
        justify-content: flex-start;
    }
}

/* =========================================================
   COMPANY NAVIGATION BAR
   ========================================================= */

.company-nav {
    background-color: #0f3b66;
    padding: 0.4rem 0;
    border-bottom: 1px solid #0a2b4a;
    margin-bottom: 1rem;
}

.company-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.company-nav .nav-link {
    color: #ffffff;
    padding: 0.45rem 0.9rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.company-nav .nav-link:hover {
    background-color: #15548c;
}

.company-nav .nav-link.active {
    background-color: #1c75c9;
    font-weight: 700;
}

.company-nav .logout-link {
    margin-left: auto;
    background-color: #b91c1c;
}
.company-nav .logout-link:hover {
    background-color: #991b1b;
}

/* Responsive: menu stacks vertically */
@media (max-width: 700px) {
    .company-nav-inner {
        flex-direction: column;
        align-items: stretch;
    }
    .company-nav .logout-link {
        margin-left: 0;
    }
}

.catalog-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.catalog-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}

.catalog-item__name {
    font-weight: 600;
    font-size: 0.95rem;
}

.catalog-item__desc {
    font-size: 0.8rem;
    color: #6b7280;
}

