/**
 * Foxco Lineup Builder - editor UI styles.
 * Renders in /wp-admin/ admin page, on frontend pages with the shortcode,
 * and inside Elementor preview.
 */

.foxco-lineup-wrap {
    --fox-primary: #2271b1;
    --fox-primary-hover: #135e96;
    --fox-ink: #1a1a2e;
    --fox-orange: #df6737;
    --fox-card-bg: #ffffff;
    --fox-card-border: rgba(0,0,0,0.08);
    --fox-muted: #6e6e80;
    --fox-bg: #f5f5f7;
    --fox-warn-bg: #fff3e0;
    --fox-warn-fg: #8b0000;
    --fox-ok-bg: #e8f5e9;
    --fox-ok-fg: #1b5e20;
    max-width: 1200px;
    margin: 0 auto;
}
.foxco-lineup-frontend {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #111;
    font-size: 14px;
    line-height: 1.5;
    padding: 14px 0;
}
.foxco-lineup-frontend * { box-sizing: border-box; }
.foxco-version { font-size: 12px; font-weight: normal; color: var(--fox-muted); margin-left: 8px; vertical-align: middle; }

.foxco-toolbar {
    background: var(--fox-card-bg); border: 1px solid var(--fox-card-border);
    border-radius: 8px; padding: 12px 16px; margin-bottom: 14px;
    display: flex; flex-wrap: wrap; gap: 12px;
    align-items: center; justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.foxco-toolbar-left, .foxco-toolbar-right {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.foxco-toolbar select, .foxco-toolbar input[type="text"] {
    padding: 7px 10px; border: 1px solid #ccc; border-radius: 4px;
    font-size: 14px; min-width: 180px;
}
.foxco-toolbar-signin .foxco-muted { flex: 1; min-width: 200px; font-size: 13px; }

.foxco-btn {
    background: #f6f7f7; border: 1px solid #ccc; color: #1a1a2e;
    padding: 7px 14px; border-radius: 4px; font-size: 13px;
    cursor: pointer; font-family: inherit; line-height: 1.3;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.foxco-btn:hover { background: #eef0f2; border-color: #999; }
.foxco-btn-primary { background: var(--fox-primary); color: #fff; border-color: var(--fox-primary); }
.foxco-btn-primary:hover { background: var(--fox-primary-hover); border-color: var(--fox-primary-hover); color: #fff; }
.foxco-btn-lg { padding: 10px 22px; font-size: 15px; font-weight: 600; }
.foxco-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.foxco-validation {
    padding: 10px 14px; border-radius: 6px; border-left: 4px solid;
    margin-bottom: 14px; font-size: 13px; line-height: 1.4;
}
.foxco-validation-ok  { background: var(--fox-ok-bg); color: var(--fox-ok-fg); border-left-color: var(--fox-ok-fg); }
.foxco-validation-bad { background: var(--fox-warn-bg); color: var(--fox-warn-fg); border-left-color: #e65100; }

.foxco-grid {
    display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 14px;
}
.foxco-card {
    background: var(--fox-card-bg); border: 1px solid var(--fox-card-border);
    border-radius: 8px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.foxco-card h2 {
    font-size: 15px; margin: 0 0 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--fox-card-border);
    color: var(--fox-ink); font-weight: 600;
}
.foxco-card-h2 {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--fox-card-border);
}
.foxco-card-h2 h2 { margin: 0; border: none; padding: 0; }
.foxco-card-hint { margin: -6px 0 12px; font-size: 12px; color: var(--fox-muted); }
.foxco-muted { color: var(--fox-muted); font-size: 13px; }
.foxco-card-roster { margin-bottom: 14px; }
.foxco-card-style-picker { grid-column: 1 / -1; }

.foxco-style-list {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px;
}
.foxco-style-card { cursor: pointer; display: block; position: relative; }
.foxco-style-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.foxco-style-card-inner {
    display: block; padding: 14px 16px; border: 2px solid var(--fox-card-border);
    border-radius: 6px; transition: border-color 0.15s, background 0.15s; background: #fafbfc;
}
.foxco-style-card:hover .foxco-style-card-inner { border-color: var(--fox-primary); }
.foxco-style-card input[type="radio"]:checked + .foxco-style-card-inner { border-color: var(--fox-primary); background: #eef6fc; }
.foxco-style-name { display: block; font-weight: 700; font-size: 15px; color: var(--fox-ink); margin-bottom: 4px; }
.foxco-style-desc { display: block; font-size: 12px; color: var(--fox-muted); line-height: 1.4; }

.foxco-style-card[data-style="roster"] .foxco-style-name::before { content: "\2316  "; color: #E10600; }
.foxco-style-card[data-style="ticket"] .foxco-style-name::before { content: "\25AC  "; color: #C29A4A; }
.foxco-style-card[data-style="field"]  .foxco-style-name::before { content: "\25C8  "; color: #1B5E20; }

/* Roster accent color picker (only shown when Roster is selected, JS toggles) */
.foxco-style-options {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--fox-card-border);
}
.foxco-color-label {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #555;
    font-weight: 600;
}
.foxco-color-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.foxco-color-row input[type="color"] {
    width: 44px; height: 32px; padding: 2px;
    border: 1px solid #ccc; border-radius: 4px; background: #fff;
    cursor: pointer;
}
.foxco-btn-tiny { padding: 4px 8px; font-size: 11px; }
.foxco-color-presets { display: inline-flex; gap: 4px; margin-left: 8px; }
.foxco-color-swatch {
    width: 22px; height: 22px;
    border: 1px solid rgba(0,0,0,0.18);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s;
}
.foxco-color-swatch:hover { transform: scale(1.15); }

.foxco-fields {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
}
.foxco-fields > label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px;
    color: #555; font-weight: 600; display: flex; flex-direction: column; gap: 3px;
}
.foxco-fields .foxco-col-2 { grid-column: span 2; }
.foxco-fields input[type="text"], .foxco-fields input[type="date"],
.foxco-fields input[type="time"], .foxco-fields select {
    padding: 7px 9px; border: 1px solid #ccc; border-radius: 4px;
    font-size: 14px; font-family: inherit; font-weight: 400;
    text-transform: none; color: var(--fox-ink); background: #fff;
}

.foxco-logo-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.foxco-logo-preview {
    width: 100px; height: 80px; border: 1px dashed #ccc; border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    background: #fafbfc; overflow: hidden;
}
.foxco-logo-preview img { max-width: 100%; max-height: 100%; }
.foxco-file-input {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0);
}

.foxco-roster-actions { display: flex; gap: 6px; }
table.foxco-lineup-edit { width: 100%; border-collapse: separate; border-spacing: 0; }
table.foxco-lineup-edit th {
    text-align: left; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.3px; color: var(--fox-muted);
    padding: 6px 8px; border-bottom: 1px solid var(--fox-card-border); font-weight: 600;
}
table.foxco-lineup-edit td { padding: 4px 6px; vertical-align: middle; }
table.foxco-lineup-edit input, table.foxco-lineup-edit select {
    width: 100%; padding: 6px 8px; border: 1px solid #ddd;
    border-radius: 4px; font-size: 14px; background: #fff;
}
.c-order { width: 40px; cursor: grab; font-weight: 700; color: var(--fox-muted); user-select: none; }
.c-jersey { width: 80px; }
.c-pos { width: 130px; }
.c-act { width: 36px; text-align: right; }
.foxco-row-remove {
    background: transparent; border: 0; color: #b00020;
    font-size: 18px; cursor: pointer; padding: 4px 8px;
}

.foxco-export-bar {
    display: flex; gap: 12px; justify-content: center; margin: 22px 0 12px;
}
.foxco-credit { text-align: center; color: var(--fox-muted); font-size: 11px; margin-top: 18px; }

.foxco-modal-bg {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 100000; padding: 20px;
}
.foxco-modal {
    background: #fff; border-radius: 8px; padding: 18px 22px;
    max-width: 600px; width: 100%; max-height: 90vh; overflow: auto;
    box-shadow: 0 12px 50px rgba(0,0,0,0.3);
}
.foxco-modal h3 { margin: 0 0 12px; font-size: 16px; color: var(--fox-ink); }
.foxco-modal-body label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px;
    color: #555; font-weight: 600; margin-bottom: 12px;
}
.foxco-modal-body input, .foxco-modal-body select, .foxco-modal-body textarea {
    font-size: 14px; font-weight: 400; text-transform: none;
    padding: 7px 9px; border: 1px solid #ccc; border-radius: 4px; font-family: inherit;
}
.foxco-modal-body textarea {
    min-height: 140px; font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 13px; line-height: 1.5; resize: vertical;
}
.foxco-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.foxco-modal-hint { margin: 6px 0 0; font-size: 12px; color: #666; line-height: 1.4; }
.foxco-modal-error {
    margin: 6px 0 0; padding: 10px 12px;
    background: #fff3e0; color: #8b0000; border-left: 3px solid #e65100;
    border-radius: 4px; font-size: 13px; line-height: 1.4;
}
.foxco-modal-section {
    margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid #f0f0f0;
}
.foxco-modal-section:last-of-type { border-bottom: none; }

.foxco-csv-map-table {
    width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px;
}
.foxco-csv-map-table th, .foxco-csv-map-table td {
    padding: 6px 8px; border-bottom: 1px solid #eee; text-align: left; vertical-align: middle;
}
.foxco-csv-map-table th {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px;
    color: var(--fox-muted); background: #fafbfc;
}
.foxco-csv-map-table select {
    padding: 4px 6px; border: 1px solid #ccc; border-radius: 3px; font-size: 13px; width: 100%;
}
.foxco-csv-preview {
    max-height: 240px; overflow: auto; border: 1px solid #eee;
    border-radius: 4px; margin-top: 8px;
}

.foxco-tabbar { display: flex; gap: 0; margin-bottom: 14px; border-bottom: 2px solid #eee; }
.foxco-tab {
    background: transparent; border: 0; padding: 8px 14px;
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--fox-muted);
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.foxco-tab.is-active { color: var(--fox-ink); border-bottom-color: var(--fox-primary); }

@media (max-width: 900px) {
    .foxco-grid { grid-template-columns: 1fr; }
    .foxco-fields { grid-template-columns: 1fr 1fr; }
    .foxco-fields .foxco-col-2 { grid-column: span 2; }
}
@media (max-width: 640px) {
    .foxco-fields { grid-template-columns: 1fr; }
    .foxco-fields .foxco-col-2 { grid-column: auto; }
    .foxco-toolbar { flex-direction: column; align-items: stretch; }
    .foxco-toolbar-left, .foxco-toolbar-right { width: 100%; }
    .foxco-toolbar select, .foxco-toolbar input[type="text"] { flex: 1; min-width: 0; }
    table.foxco-lineup-edit thead { display: none; }
    table.foxco-lineup-edit tbody { display: block; }
    table.foxco-lineup-edit tr {
        display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
        position: relative; padding: 38px 10px 10px;
        border: 1px solid var(--fox-card-border); border-radius: 6px;
        margin-bottom: 10px; background: #fff;
    }
    table.foxco-lineup-edit td { display: block; padding: 0; min-width: 0; }
    table.foxco-lineup-edit td.c-order {
        position: absolute; top: 8px; left: 12px;
        background: rgba(0,0,0,0.04); padding: 4px 10px;
        border-radius: 4px; font-size: 14px;
    }
    table.foxco-lineup-edit td.c-act { position: absolute; top: 4px; right: 6px; }
    table.foxco-lineup-edit td.c-name { grid-column: 1 / -1; grid-row: 1; }
    table.foxco-lineup-edit td.c-jersey { grid-column: 1; grid-row: 2; }
    table.foxco-lineup-edit td.c-pos { grid-column: 2; grid-row: 2; }
    .foxco-export-bar { flex-direction: column; }
    .foxco-export-bar form { width: 100%; }
    .foxco-export-bar .foxco-btn { width: 100%; }
}
