:root {
    --primary: #002D62; /* Baseball Blue */
    --secondary: #BA0021; /* Baseball Red */
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --white: #ffffff;
    --border: #dee2e6;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    margin: 0;
    padding: 0;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--primary);
}

.auth-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-box h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* Dashboard Layout */
.admin-navbar {
    background-color: var(--primary);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.admin-navbar .brand {
    font-weight: bold;
    font-size: 1.25rem;
}

.admin-navbar a {
    color: var(--white);
    text-decoration: none;
    margin-left: 1rem;
    opacity: 0.8;
}

.admin-navbar a:hover {
    opacity: 1;
}

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

/* Cards & Tables */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary);
}

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

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--light);
    color: var(--gray);
    font-weight: 600;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, textarea, select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s, background-color 0.15s;
}

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

.btn-primary:hover {
    background-color: #001f4d;
}

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: var(--gray);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

/* Enhanced Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent background scroll */
    background-color: rgba(0,0,0,0.6);
    /* Center content vertically & horizontally */
    display: none; /* JS toggles this to flex */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background-color: var(--white);
    margin: 0; 
    padding: 0; /* Let header/footer/body handle padding */
    border-radius: 8px;
    width: 95%;
    max-width: 90vw; /* Widen the default modal */
    max-height: 90vh; /* Max height relative to viewport */
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    /* Remove old margin/position hacks */
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto; /* Scrollable content area */
    flex: 1; /* Take remaining height */
}

/* Event Form Layout */
.event-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .event-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.full-width {
    grid-column: 1 / -1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Form Builder Styling Enhancements */
.field-item {
    background: white;
    border: 1px solid var(--border);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.close {
    position: static; /* Reset absolute positioning */
    color: var(--gray);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}
.close:hover { color: var(--secondary); }

