/* One2ManySites — Control Panel Styles */

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9375rem;
    color: #1e293b;
    background-color: #f8fafc;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 2px; }

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

table { border-collapse: collapse; width: 100%; }

/* === Layout === */
.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    width: 100%;
}

main.container {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* === Navigation === */
.nav {
    background-color: #1e293b;
    color: #ffffff;
    padding: 0;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    height: 3.5rem;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.125rem;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-brand:hover { text-decoration: none; opacity: 0.9; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-links a {
    color: #cbd5e1;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.15s;
}

.nav-links a:hover { color: #ffffff; text-decoration: none; }
.nav-links a:focus-visible { outline: 2px solid #60a5fa; outline-offset: 2px; border-radius: 2px; }

.nav-email {
    color: #94a3b8;
    font-size: 0.8125rem;
}

/* === Footer === */
.footer {
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 1.25rem 0;
    text-align: centre;
    margin-top: auto;
}

.footer p {
    color: #64748b;
    font-size: 0.8125rem;
    text-align: center;
}

/* === Alerts === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-success { background-color: #dcfce7; color: #166534; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-error { background-color: #fee2e2; color: #991b1b; }
.badge-info { background-color: #dbeafe; color: #1e40af; }
.badge-muted { background-color: #f1f5f9; color: #64748b; }

/* === Cards === */
.card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background-color: #ffffff;
    color: #1e293b;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { background-color: #f8fafc; border-color: #cbd5e1; text-decoration: none; }
.btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.btn-primary {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.btn-primary:hover { background-color: #1d4ed8; border-color: #1d4ed8; }

.btn-danger {
    background-color: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.btn-danger:hover { background-color: #b91c1c; border-color: #b91c1c; }

.btn-small {
    padding: 0.25rem 0.625rem;
    font-size: 0.8125rem;
}

.btn-link {
    background: none;
    border: none;
    color: #cbd5e1;
    padding: 0;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-link:hover { color: #ffffff; text-decoration: underline; }

/* === Tables === */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.table th {
    font-weight: 600;
    color: #64748b;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    background-color: #f8fafc;
}

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

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

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #1e293b;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-textarea {
    min-height: 6rem;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
}

/* === Tabs === */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover { color: #1e293b; text-decoration: none; }
.tab:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }

.tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* === Utility — Display === */
.inline { display: inline; }

/* === Utility — Text === */
.text-muted { color: #64748b; }
.text-success { color: #16a34a; }
.text-error { color: #dc2626; }

/* === Utility — Spacing === */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* === Utility — Flex === */
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #64748b;
    font-size: 0.9375rem;
}

/* === Messages (Tickets) === */
.message {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    max-width: 80%;
}

.message-customer {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    margin-right: auto;
}

.message-admin {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    margin-left: auto;
}

.message-system {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-style: italic;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    max-width: 100%;
}

/* === Progress Bar === */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #2563eb;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* === Responsive === */
@media (max-width: 768px) {
    .nav-inner {
        flex-wrap: wrap;
        height: auto;
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .nav-email {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .table {
        font-size: 0.8125rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.625rem;
    }

    .message {
        max-width: 95%;
    }

    .flex-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    main.container {
        padding-top: 1.25rem;
        padding-bottom: 1.25rem;
    }

    .card {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
        flex-shrink: 0;
    }
}
