/* =========================================================
   Public Theme — Unified Design System for User-Facing Pages
   Clean, modern, consistent across all pages
   ========================================================= */

/* ---------- Design Tokens (shared with admin) ---------- */
:root {
    /* Colors */
    --theme-primary:      #4f46e5;
    --theme-primary-600:  #4338ca;
    --theme-primary-50:   #eef2ff;
    --theme-primary-100:  #e0e7ff;
    
    --theme-secondary:    #6366f1;
    --theme-secondary-600: #4f46e5;
    
    --theme-success:      #10b981;
    --theme-success-50:   #ecfdf5;
    --theme-warning:      #f59e0b;
    --theme-warning-50:   #fffbeb;
    --theme-danger:       #ef4444;
    --theme-danger-50:    #fef2f2;
    --theme-info:         #0ea5e9;
    --theme-info-50:      #f0f9ff;
    
    /* Backgrounds */
    --theme-bg:           #f7f8fb;
    --theme-bg-light:     #ffffff;
    --theme-bg-alt:       #fafbfc;
    
    /* Text */
    --theme-text:         #0f172a;
    --theme-text-muted:   #64748b;
    --theme-text-soft:    #94a3b8;
    
    /* Borders */
    --theme-border:       #e5e7eb;
    --theme-border-soft:  #eef0f3;
    
    /* Spacing & Sizing */
    --theme-radius-sm:    6px;
    --theme-radius:       10px;
    --theme-radius-lg:    14px;
    --theme-radius-xl:    18px;
    
    --theme-shadow-xs:    0 1px 2px rgba(15,23,42,.04);
    --theme-shadow-sm:    0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --theme-shadow-md:    0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
    --theme-shadow-lg:    0 12px 32px rgba(15,23,42,.08), 0 4px 8px rgba(15,23,42,.04);
    
    --theme-transition:   180ms cubic-bezier(.4,0,.2,1);
}

/* ---------- Base Styles ---------- */
body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--theme-bg);
    color: var(--theme-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.005em;
    line-height: 1.6;
}

a {
    color: var(--theme-primary);
    text-decoration: none;
    transition: color var(--theme-transition);
}

a:hover {
    color: var(--theme-primary-600);
    text-decoration: none;
}

/* ---------- Headers ---------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

/* ---------- Navigation ---------- */
nav, .navbar {
    background: var(--theme-bg-light);
    border-bottom: 1px solid var(--theme-border);
    padding: 1rem 0;
    box-shadow: var(--theme-shadow-xs);
}

nav a, .navbar a {
    color: var(--theme-text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--theme-radius);
    transition: all var(--theme-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

nav a:hover, .navbar a:hover {
    color: var(--theme-primary);
    background: var(--theme-primary-50);
}

nav a.active {
    color: var(--theme-primary-600);
    background: var(--theme-primary-100);
    font-weight: 600;
}

/* ---------- Containers & Sections ---------- */
.container, .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

section {
    padding: 3rem 0;
}

section.section-alt {
    background: var(--theme-bg-alt);
}

/* ---------- Cards ---------- */
.card {
    background: var(--theme-bg-light);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--theme-shadow-xs);
    transition: all var(--theme-transition);
}

.card:hover {
    box-shadow: var(--theme-shadow-md);
    transform: translateY(-2px);
}

.card-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--theme-text);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--theme-border-soft);
}

.card-body {
    color: var(--theme-text-muted);
    line-height: 1.7;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--theme-border-soft);
    color: var(--theme-text-soft);
    font-size: 0.9rem;
}

/* ---------- Buttons ---------- */
.btn, button, input[type="button"], input[type="submit"] {
    border-radius: var(--theme-radius);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.65rem 1.5rem;
    border: none;
    cursor: pointer;
    transition: all var(--theme-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary, .btn-primary:not(:disabled) {
    background: var(--theme-primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(79,70,229,.2);
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--theme-primary-600);
    box-shadow: 0 4px 12px rgba(79,70,229,.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--theme-bg-alt);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
}

.btn-secondary:hover, .btn-secondary:focus {
    background: var(--theme-border-soft);
    border-color: #d6d9df;
}

.btn-success {
    background: var(--theme-success);
    color: #fff;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--theme-danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--theme-primary);
    color: var(--theme-primary);
    padding: 0.55rem 1.4rem;
}

.btn-outline:hover {
    background: var(--theme-primary-50);
    color: var(--theme-primary-600);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 0.8rem 1.8rem;
    font-size: 1.05rem;
}

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

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

label {
    display: block;
    font-weight: 600;
    color: var(--theme-text);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    font-size: 0.95rem;
    color: var(--theme-text);
    background: var(--theme-bg-light);
    transition: all var(--theme-transition);
    font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 3px var(--theme-primary-50);
    background: var(--theme-bg-light);
}

input::placeholder {
    color: var(--theme-text-soft);
}

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

.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: var(--theme-danger);
    box-shadow: 0 0 0 3px var(--theme-danger-50);
}

.error-message {
    color: var(--theme-danger);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

.help-text {
    color: var(--theme-text-muted);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ---------- Tables ---------- */
.table, table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.table thead,
table thead {
    background: var(--theme-bg-alt);
}

.table th,
table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--theme-text-muted);
    border-bottom: 2px solid var(--theme-border);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td,
table td {
    padding: 1rem;
    border-bottom: 1px solid var(--theme-border-soft);
    color: var(--theme-text);
}

.table tbody tr:hover,
table tbody tr:hover {
    background: var(--theme-bg-alt);
}

.table tbody tr:last-child td,
table tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- Badges & Tags ---------- */
.badge, .tag {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.badge-primary {
    background: var(--theme-primary-50);
    color: var(--theme-primary-600);
    border-color: var(--theme-primary-100);
}

.badge-success {
    background: var(--theme-success-50);
    color: #047857;
    border-color: #a7f3d0;
}

.badge-warning {
    background: var(--theme-warning-50);
    color: #b45309;
    border-color: #fde68a;
}

.badge-danger {
    background: var(--theme-danger-50);
    color: #b91c1c;
    border-color: #fecaca;
}

.badge-info {
    background: var(--theme-info-50);
    color: #0369a1;
    border-color: #bae6fd;
}

.badge-secondary {
    background: var(--theme-bg-alt);
    color: var(--theme-text-muted);
    border-color: var(--theme-border);
}

/* ---------- Alerts ---------- */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--theme-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid transparent;
}

.alert-info {
    background: var(--theme-info-50);
    color: #075985;
    border-color: #bae6fd;
}

.alert-success {
    background: var(--theme-success-50);
    color: #065f46;
    border-color: #a7f3d0;
}

.alert-warning {
    background: var(--theme-warning-50);
    color: #92400e;
    border-color: #fde68a;
}

.alert-danger {
    background: var(--theme-danger-50);
    color: #991b1b;
    border-color: #fecaca;
}

.alert-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.alert-close {
    margin-left: auto;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: inherit;
    opacity: 0.7;
    transition: opacity var(--theme-transition);
}

.alert-close:hover {
    opacity: 1;
}

/* ---------- Hero Section ---------- */
.hero {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary-600) 100%);
    color: #fff;
    padding: 4rem 2rem;
    border-radius: var(--theme-radius-lg);
    text-align: center;
    margin: 2rem 0;
}

.hero h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    color: rgba(255,255,255,.9);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* ---------- Footer ---------- */
footer {
    background: var(--theme-bg-light);
    border-top: 1px solid var(--theme-border);
    padding: 2rem;
    margin-top: 3rem;
    color: var(--theme-text-muted);
    font-size: 0.9rem;
    text-align: center;
}

footer a {
    color: var(--theme-primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ---------- Grids ---------- */
.grid, .row {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

@media (max-width: 768px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* ---------- Typography ---------- */
.text-primary { color: var(--theme-primary); }
.text-secondary { color: var(--theme-secondary); }
.text-success { color: var(--theme-success); }
.text-warning { color: var(--theme-warning); }
.text-danger { color: var(--theme-danger); }
.text-muted { color: var(--theme-text-muted); }
.text-light { color: var(--theme-text-soft); }

.bg-primary { background-color: var(--theme-primary) !important; }
.border-primary { border-color: var(--theme-primary) !important; }
.btn-outline-primary {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
}
.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--theme-primary-50);
    color: var(--theme-primary-600);
}
.nav-tabs .nav-link:hover,
.nav-pills .nav-link:hover {
    color: var(--theme-primary);
}
.nav-tabs .nav-link.active,
.nav-pills .nav-link.active,
.nav-tabs .nav-link.active:hover,
.nav-pills .nav-link.active:hover {
    color: var(--theme-primary);
    border-color: var(--theme-primary);
}
.nav-tabs .nav-link.active::after {
    background: var(--theme-primary);
}
.page-link {
    color: var(--theme-primary);
}
.page-link:hover {
    color: var(--theme-primary-600);
}
.page-item.active .page-link {
    background: var(--theme-primary);
    border-color: var(--theme-primary);
    color: #fff;
}

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

.text-bold { font-weight: 700; }
.text-semibold { font-weight: 600; }

/* ---------- Spacing Utilities ---------- */
.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.m-0 { margin: 0; }
.m-1 { margin: 0.5rem; }
.m-2 { margin: 1rem; }
.m-3 { margin: 1.5rem; }
.m-4 { margin: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .container, .container-fluid {
        padding: 1.5rem 1rem;
    }
    
    .btn {
        padding: 0.55rem 1.2rem;
        font-size: 0.9rem;
    }
    
    section {
        padding: 2rem 0;
    }
}

/* ---------- Utility Classes ---------- */
.d-flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.rounded { border-radius: var(--theme-radius); }
.rounded-lg { border-radius: var(--theme-radius-lg); }
.rounded-full { border-radius: 9999px; }

.shadow-sm { box-shadow: var(--theme-shadow-sm); }
.shadow-md { box-shadow: var(--theme-shadow-md); }
.shadow-lg { box-shadow: var(--theme-shadow-lg); }

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}
