/* ========================================
   Locro - Global Styles
   Clean, minimal design with generous whitespace
   ======================================== */

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #596577;
    --color-text-light: #798494;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --font: 'Roboto', system-ui, -apple-system, sans-serif;
    --font-heading: 'Roboto Slab', Georgia, serif;
    --font-ui: 'Ubuntu', system-ui, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.5;
    min-height: 100vh;
}

/* ---- Typography ---- */

h1 { font-size: 1.75rem; font-weight: 700; font-family: var(--font-heading); }
h2 { font-size: 1.375rem; font-weight: 600; margin-bottom: 16px; font-family: var(--font-heading); }
h3 { font-size: 1.125rem; font-weight: 600; font-family: var(--font-heading); }
h4 { font-size: 1rem; font-weight: 600; margin: 16px 0 8px; font-family: var(--font-heading); }

p { color: var(--color-text-muted); }

/* ---- Links ---- */

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

/* ---- Buttons ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-ui);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 6px;
    text-transform: uppercase;
}

.btn-assign {
    padding: 11px 12px;
    background-color: var(--color-primary);
    color: #fff
}

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

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover, .btn-assign:hover {
    background: var(--color-primary-hover);
}

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

.btn-text {
    border: none;
    background: none;
    color: var(--color-text-muted);
}
.btn-text:hover {
    color: var(--color-text);
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.8125rem;
}

.btn-icon {
    padding: 6px 10px;
    font-size: 1rem;
}

.btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ---- Forms ---- */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9375rem;
    font-family: var(--font-ui);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

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

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20d%3D%22M10.293%2C3.293%2C6%2C7.586%2C1.707%2C3.293A1%2C1%2C0%2C0%2C0%2C.293%2C4.707l5%2C5a1%2C1%2C0%2C0%2C0%2C1.414%2C0l5-5a1%2C1%2C0%2C1%2C0-1.414-1.414Z%22%20fill%3D%22%23000000%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    background-size: .6em;
}

/* ---- Cards ---- */

.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card-body {
    margin-top: 12px;
}

.card-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* ---- Tables ---- */

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

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background: var(--color-bg);
}

/* ---- Badges ---- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    background: var(--color-bg);
    color: var(--color-text-muted);
}

.badge-green {
    background: #dcfce7;
    color: var(--color-success);
}

.badge-red {
    background: #fee2e2;
    color: var(--color-danger);
}

.badge-yellow {
    background: #fef3c7;
    color: var(--color-warning);
}

.badge-blue {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-grey {
    background: #f1f5f9;
    color: var(--color-text-muted);
}

.form-error {
    background: #fee2e2;
    color: var(--color-danger);
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

/* ---- Event detail header ---- */

.detail-header {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.detail-header h3 {
    margin: 0;
    padding-right: 12px;
    border-right: 2px solid var(--color-border);
}

.detail-header .date {
    padding-left: 12px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* ---- Navigation ---- */

/* ---- Offline indicator ---- */

.offline-banner {
    background: #fef3c7;
    border-bottom: 1px solid #f59e0b;
    color: #92400e;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    padding: 8px 16px;
    z-index: 110;
    position: sticky;
    top: 0;
}

.offline-pill {
    font-size: 0.75rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}

.top-nav {
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-right: 32px;
}

.nav-logo {
    height: 36px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.15s ease;
}

.nav-link:hover {
    color: var(--color-text);
    background: var(--color-bg);
    text-decoration: none;
}

.nav-link.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ---- Language Switcher ---- */

.lang-switcher, .lang-switcher-small {
    display: flex;
    gap: 4px;
}

.lang-btn {
    background: none;
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 2px 6px;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.lang-btn.active, .lang-btn:hover {
    opacity: 1;
    border-color: var(--color-primary-light);
}

/* ---- Main Content ---- */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ---- View Header ---- */

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ---- List Container ---- */

.list-container {
    display: grid;
    gap: 16px;
}

/* ---- Modal ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Wider layout used for event-detail and venue modals */
.modal-content.modal-wide {
    max-width: 1100px;
}

/* ---- Pill → Modal expand/collapse animations ---- */
@keyframes modal-overlay-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes modal-overlay-out { from { opacity: 1 } to { opacity: 0 } }
/* Content animations used for non-pill modals only (pill modals use morph div) */
@keyframes modal-content-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes modal-content-out { from { opacity: 1 } to { opacity: 0 } }

.modal-opening         { animation: modal-overlay-in  0.35s ease forwards; }
.modal-closing         { animation: modal-overlay-out 0.32s ease forwards; }
.modal-content-opening { animation: modal-content-in  0.25s ease forwards; }
.modal-content-closing { animation: modal-content-out 0.15s ease forwards; }

/* Close × in top-right corner */
.modal-close-x {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0 4px;
}
.modal-close-x:hover { color: var(--color-text); }

/* Two-column row inside forms */
.form-row {
    display: flex;
    gap: 12px;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ---- Error messages ---- */

.optional {
    font-weight: normal;
    font-size: 0.8em;
    color: var(--color-text-muted, #888);
}

.error-message {
    color: var(--color-danger);
    font-size: 0.875rem;
    padding: 8px 12px;
    background: #fee2e2;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

/* ---- Empty state ---- */

.empty, .empty-message {
    color: var(--color-text-light);
    font-style: italic;
    padding: 16px 0;
}

/* ---- Role pills ---- */
.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}
.role-pill .remove-pill {
    font-size: 1rem;
    line-height: 1;
    color: #1e40af;
    opacity: 0.7;
}
.role-pill .remove-pill:hover { opacity: 1; }

.role-pill-sm {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .top-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
    }
    .nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-top: 8px;
    }
    .main-content {
        padding: 16px;
    }
}
