:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
}

h1,
h2,
h3,
h4 {
    line-height: 1.2;
    margin-bottom: 0.5em;
}

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

button {
    cursor: pointer;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.grid {
    display: grid;
    gap: 1rem;
}

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

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.p-4 {
    padding: 1rem;
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    border: none;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.input:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}

/* Landing Page */
.landing-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    color: white;
    text-align: center;
}

.landing-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.landing-hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Admin Dashboard */
.sidebar {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    min-height: 100vh;
    position: fixed;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: bold;
    font-size: 1.25rem;
    color: var(--primary);
}

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    transition: 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: #f1f5f9;
    color: var(--primary);
}

.main-content {
    margin-left: 260px;
    padding: 2rem;
}

/* Status Badges */
.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Drag & Drop */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    transition: 0.2s;
    background: #f8fafc;
}

.drop-zone.dragover {
    border-color: var(--primary);
    background: #e0e7ff;
}

/* Portal Specific */
.format-card {
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
}

.format-card:hover,
.format-card.selected {
    border-color: var(--primary);
    background: #e0e7ff;
}

.chip {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #e2e8f0;
    border-radius: 99px;
    font-size: 0.85rem;
    margin: 0.25rem;
    cursor: pointer;
}

.chip:hover,
.chip.active {
    background: var(--primary);
    color: white;
}

/* Masked Table */
.params-mask td {
    font-family: monospace;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: 0.3s;
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .landing-hero h1 {
        font-size: 2.5rem;
    }
}

/* Utils */
.hidden {
    display: none !important;
}

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

.stat-card {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--surface);
    width: 90%;
    max-width: 480px;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin: auto;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    border: 1px solid var(--border);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}