/* ============================================================
   BrewersCourt — main.css
   Color scheme: coral/salmon primary, dark charcoal text
   ============================================================ */

/* --- Reset & Base ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #e05c4b;
    --primary-dark:  #c44a39;
    --primary-light: #f2aea6;
    --primary-bg:    #fdf2f0;

    --text:          #2c2c2c;
    --text-muted:    #6b6b6b;
    --text-light:    #999;

    --border:        #e0ddd8;
    --bg:            #f8f7f4;
    --white:         #ffffff;

    --success:       #2e7d52;
    --success-bg:    #eaf5ee;
    --error:         #b91c1c;
    --error-bg:      #fef2f2;
    --warning:       #92400e;
    --warning-bg:    #fffbeb;
    --info:          #1e40af;
    --info-bg:       #eff6ff;

    --radius:        6px;
    --radius-lg:     10px;
    --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:     0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Courier New', monospace;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

img { max-width: 100%; height: auto; display: block; }

/* --- Typography --------------------------------------------- */
h1 { font-size: 1.75rem; font-weight: 600; line-height: 1.25; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; margin-bottom: 0.4rem; }
h3 { font-size: 1.1rem;  font-weight: 600; margin-bottom: 0.4rem; }
p  { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

/* --- Layout -------------------------------------------------- */
.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

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

.page-header h1 { margin-bottom: 0; }

/* --- Site Header -------------------------------------------- */
.site-header {
    background: var(--white);
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.5px;
}
.logo-brewer { color: var(--text); }
.logo-court  { color: var(--primary); }

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav a {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.site-nav a:hover { color: var(--primary); }

/* --- Footer -------------------------------------------------- */
.site-footer {
    background: var(--text);
    color: #ccc;
    padding: 2rem 1.5rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
    justify-content: space-between;
}

.footer-brand .site-logo { font-size: 1.2rem; margin-bottom: 0.25rem; }
.footer-brand .logo-brewer { color: #ccc; }
.footer-brand p { font-size: 0.85rem; color: #999; margin: 0; }

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}
.footer-links a { color: #aaa; font-size: 0.9rem; }
.footer-links a:hover { color: var(--primary-light); text-decoration: none; }

.footer-copy {
    width: 100%;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* --- Buttons ------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font);
    line-height: 1;
}
.btn:hover { text-decoration: none; }

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

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

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

.btn-sm  { padding: 0.35rem 0.8rem;  font-size: 0.82rem; }
.btn-xs  { padding: 0.25rem 0.6rem;  font-size: 0.78rem; }
.btn-lg  { padding: 0.7rem 1.5rem;   font-size: 1rem; }
.btn-block { width: 100%; }

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

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

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="time"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    font-family: var(--font);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--text);
    transition: border-color 0.15s;
    line-height: 1.5;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(224, 92, 75, 0.12);
}

.form-group textarea { resize: vertical; min-height: 90px; }

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    cursor: pointer;
    font-weight: 400;
}

.form-link {
    font-size: 0.875rem;
    color: var(--primary);
}

/* --- Alerts -------------------------------------------------- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border-left: 3px solid;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}
.alert span { flex: 1; }
.alert p { margin-bottom: 0.2rem; }
.alert p:last-child { margin-bottom: 0; }
.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.5;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    color: inherit;
}
.alert-close:hover { opacity: 1; }

.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: var(--error); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info); }

/* --- Cards --------------------------------------------------- */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

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

/* --- Data Tables -------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--primary-bg); }

/* --- Status Badges ------------------------------------------ */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-draft      { background: #f1f0ea; color: #555; }
.status-open       { background: var(--success-bg); color: var(--success); }
.status-closed     { background: #fef9c3; color: #854d0e; }
.status-judging    { background: #eff6ff; color: #1e40af; }
.status-complete   { background: #f3e8ff; color: #6b21a8; }
.status-private  { background: #EDE7F6; color: #4527A0; }
.status-archived   { background: #f1f0ea; color: #888; }
.status-pending    { background: #fef9c3; color: #854d0e; }
.status-confirmed  { background: var(--success-bg); color: var(--success); }
.status-withdrawn  { background: #f1f0ea; color: #888; }

/* --- Auth Pages --------------------------------------------- */
.page-auth .site-main { display: flex; align-items: center; justify-content: center; padding: 3rem 1rem; }

.auth-wrap { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-switch {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
    margin-bottom: 0;
}

/* --- Dashboard Grid ----------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.dashboard-card--full {
    grid-column: 1 / -1;
}

/* --- Empty States ------------------------------------------- */
.empty-state {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 1rem 0;
    text-align: center;
}

/* --- Utility ------------------------------------------------- */
.text-muted   { color: var(--text-muted); }
.text-small   { font-size: 0.85rem; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* --- Responsive --------------------------------------------- */
@media (max-width: 700px) {
    .header-inner { padding: 0 1rem; }
    .site-nav a:not(.btn) { display: none; }
    .page-wrap { padding: 1.25rem 1rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 0.82rem; }
    .auth-card { padding: 1.5rem; }
}

/* ----------------------------------------------------------------
   Address Autocomplete
---------------------------------------------------------------- */
.addr-search-wrap { position: relative; }
.addr-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1.5px solid var(--primary);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 200;
    max-height: 240px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.addr-dropdown-item {
    padding: 0.6rem 0.9rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    line-height: 1.3;
}
.addr-dropdown-item:last-child { border-bottom: none; }
.addr-dropdown-item:hover,
.addr-dropdown-item.active { background: var(--primary-bg); color: var(--primary); }

/* Address preview card */
.addr-preview {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-top: 0.4rem;
}
.addr-preview-hidden,
.addr-preview[style*="display:none"],
.addr-preview[style*="display: none"] { display: none !important; }
.addr-preview-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.05rem; }
.addr-preview-text { flex: 1; padding-right: 10px; }
.addr-preview-main { font-weight: 500; }
.addr-preview-sub  { color: var(--text-muted); font-size: 0.8rem; }
.addr-clear {
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
    padding: 0.3rem;
    padding-left: 10px !important;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    line-height: 0;
}
.addr-clear:hover { color: var(--error); background: var(--error-bg); }

/* Location builder date inputs */
#loc-jstart, #loc-jend, #loc-ceremony {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
}
#loc-jstart:focus, #loc-jend:focus, #loc-ceremony:focus {
    outline: none;
    border-color: var(--primary);
}

/* Location cards on competition view */
.location-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.75rem;
}
.location-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.location-card-body {
    padding: 0.75rem 0.9rem;
    font-size: 0.875rem;
}
.location-card-body p { margin-bottom: 0.2rem; }
.location-card-body p:last-child { margin-bottom: 0; }
