/* Base custom styles mimicking utilities for a clean, premium look */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --success-bg: #f0fdf4;
    --success-text: #16a34a;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

/* Typography styles */
.text-center { text-align: center; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-gray-900 { color: #111827; }
.text-gray-700 { color: #374151; }
.text-gray-500 { color: #6b7280; }
.text-white { color: #ffffff; }
.text-red-600 { color: var(--error-text); }
.text-green-600 { color: var(--success-text); }
.text-blue-600 { color: var(--primary); }

/* Layout utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.min-h-screen { min-height: 100vh; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }

/* Spacing */
.p-8 { padding: 2rem; }
.p-6 { padding: 1.5rem; }
.p-4 { padding: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-2 { margin-top: 0.5rem; }

/* Backgrounds & borders */
.bg-gray-50 { background-color: #f9fafb; }
.bg-white { background-color: #ffffff; }
.bg-red-50 { background-color: var(--error-bg); }
.bg-green-50 { background-color: var(--success-bg); }
.border { border: 1px solid var(--border); }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }
.hidden { display: none !important; }
.block { display: block; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Components */
.card {
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.table-container {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    background-color: #fff;
    transition: all 0.2s ease;
}

.focus-outline:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.875rem;
}
.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}
.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}
.btn-outline:hover {
    background-color: #f1f5f9;
}
.btn-danger {
    background-color: #ef4444;
    color: white;
}
.btn-danger:hover {
    background-color: #dc2626;
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Base Layout for Dashboard & Public App */
.navbar {
    background: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Radio Group styling for Survey */
.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}
.radio-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.radio-label input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
    cursor: pointer;
}
.radio-label:hover {
    color: var(--text-main);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-green { background-color: var(--success-bg); color: var(--success-text); }
.badge-gray { background-color: #f1f5f9; color: var(--text-muted); }

/* ============================================
   RESPONSIVE — TABLET (≤ 1023px)
   ============================================ */
@media (max-width: 1023px) {
    .navbar {
        padding: 0.75rem 1.25rem;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .container {
        padding: 1.25rem;
    }
}

/* ============================================
   RESPONSIVE — MOBILE (≤ 639px)
   ============================================ */
@media (max-width: 639px) {

    /* --- Navbar --- */
    .navbar {
        padding: 0.625rem 1rem;
        gap: 6px;
    }

    /* --- Container --- */
    .container {
        padding: 1rem;
    }

    /* --- Typography scaling --- */
    .text-2xl { font-size: 1.25rem; line-height: 1.75rem; }
    .text-xl  { font-size: 1.1rem;  line-height: 1.6rem; }

    /* --- Responsive grid utilities --- */
    .sm-grid-cols-1 { grid-template-columns: 1fr !important; }
    .sm-flex-col    { flex-direction: column !important; }
    .sm-w-full      { width: 100% !important; }

    /* --- Radio group: allow wrap --- */
    .radio-group {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* --- Cards: reduce padding on mobile --- */
    .card.p-8 { padding: 1.25rem; }
    .card.p-6 { padding: 1rem; }

    /* --- Buttons: full-width in stacked context --- */
    .btn { font-size: 0.8125rem; }

    /* --- Hide helper: hide non-critical text on mobile --- */
    .mobile-hide { display: none !important; }

    /* --- Navbar: compact mode on mobile --- */
    .navbar-label { display: none; }

    /* --- Prevent content overflow --- */
    body { overflow-x: hidden; }
    * { max-width: 100%; }
    img, canvas, svg { max-width: 100%; height: auto; }
}
