/*
 * Bee1 Fashion Size Charts - Admin & Frontend Styles
 * Studio Bee1 Brand - Clean, Professional, NASA/Apple grade design
 * Colors: #171f3b (primary navy), #fbc109 (gold accent), #f7f8fa (bg)
 * Font: Rubik / system sans-serif
 * Version: 1.0.0
 */

:root {
    --bee1-primary: #171f3b;
    --bee1-accent: #fbc109;
    --bee1-accent-hover: #fdc730;
    --bee1-bg: #f7f8fa;
    --bee1-card: #ffffff;
    --bee1-text: #171f3b;
    --bee1-text-secondary: #64748b;
    --bee1-border: #e2e8f0;
}

/* Admin Table Editor */
#bee1-fsc-table-editor {
    background: var(--bee1-card);
    padding: 24px;
    border: 1px solid var(--bee1-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(23, 31, 59, 0.06);
    margin-bottom: 20px;
    font-family: 'Rubik', system-ui, -apple-system, sans-serif;
}

#bee1-fsc-table-editor h3 {
    color: var(--bee1-primary);
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid var(--bee1-accent);
    padding-bottom: 8px;
}

.bee1-fsc-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    min-height: 52px;
}

.bee1-fsc-column-pill {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 2px solid var(--bee1-border);
    border-radius: 9999px;
    padding: 6px 14px 6px 18px;
    font-size: 0.9rem;
    color: var(--bee1-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.bee1-fsc-column-pill:hover {
    border-color: var(--bee1-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(251, 193, 9, 0.15);
}

.bee1-fsc-column-pill .col-name {
    margin-right: 8px;
    font-weight: 500;
}

.bee1-fsc-column-pill .delete-col {
    color: #e53e3e;
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1;
    padding: 0 4px;
    margin-left: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.bee1-fsc-column-pill .delete-col:hover {
    opacity: 1;
    color: #c53030;
}

/* Both admin buttons – explicit contrast so no WP admin theme can override */
#bee1-fsc-add-column,
#bee1-fsc-add-row {
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-block;
}

#bee1-fsc-add-column {
    background: var(--bee1-accent) !important;
    color: #171f3b !important;
    /* force dark navy – never white */
    border: 2px solid #e0aa00 !important;
    box-shadow: 0 2px 8px rgba(251, 193, 9, 0.3);
}

#bee1-fsc-add-column:hover {
    background: var(--bee1-accent-hover) !important;
    color: #171f3b !important;
    transform: translateY(-1px);
}

#bee1-fsc-add-row {
    background: #ffffff !important;
    color: #171f3b !important;
    /* force dark navy – never white */
    border: 2px solid #171f3b !important;
    margin-top: 15px;
}

#bee1-fsc-add-row:hover {
    background: #171f3b !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* Table Styles - Admin editor (pure class, no WP class dependency) */
#bee1-fsc-rows-table,
table.bee1-fsc-admin-table,
.bee1-fsc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-family: 'Rubik', system-ui, sans-serif;
    background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

/* Admin table headers – override any WP admin theme completely */
#bee1-fsc-rows-table th,
table.bee1-fsc-admin-table th {
    background: #f1f5f9 !important;
    color: #171f3b !important;
    font-weight: 600 !important;
    padding: 14px 12px !important;
    text-align: right !important;
    border-bottom: 3px solid #fbc109 !important;
    font-size: 0.9rem !important;
    white-space: nowrap;
}

/* Frontend table headers */
.bee1-fsc-table th {
    background: #f1f5f9;
    color: #171f3b;
    font-weight: 600;
    padding: 14px 12px;
    text-align: right;
    border-bottom: 3px solid #fbc109;
    font-size: 0.9rem;
}

/* Admin table cells */
#bee1-fsc-rows-table td,
table.bee1-fsc-admin-table td {
    padding: 12px 12px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    text-align: right !important;
    vertical-align: middle !important;
    font-size: 0.92rem !important;
    color: #171f3b !important;
    background: #ffffff !important;
}

/* Striped rows manually (since we removed WP striped class) */
table.bee1-fsc-admin-table tbody tr:nth-child(even) td {
    background: #f8fafc !important;
}

/* Frontend table cells */
.bee1-fsc-table td {
    padding: 12px 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: right;
    vertical-align: middle;
    font-size: 0.92rem;
    color: #171f3b;
}

#bee1-fsc-rows-table td[contenteditable="true"] {
    outline: 2px solid transparent;
    transition: outline 0.2s, background 0.2s;
    min-width: 80px;
    cursor: text;
    color: #171f3b !important;
    /* always dark text, even on yellow bg */
    background: #ffffff;
}

#bee1-fsc-rows-table td[contenteditable="true"]:focus {
    outline: 2px solid #171f3b;
    /* dark outline instead of yellow-on-yellow */
    background: #fffce8;
    color: #171f3b !important;
}

#bee1-fsc-rows-table .delete-row {
    width: 40px;
    text-align: center;
    color: #e53e3e;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    border-left: 1px solid var(--bee1-border);
    transition: background 0.2s;
}

#bee1-fsc-rows-table .delete-row:hover {
    background: #fee2e2;
    color: #c53030;
}

/* Frontend Wrapper */
.bee1-fsc-wrapper {
    margin: 48px 0;
    background: var(--bee1-card);
    border: 1px solid var(--bee1-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgb(23 31 59 / 0.1),
        0 4px 6px -4px rgb(23 31 59 / 0.1);
    font-family: 'Rubik', system-ui, sans-serif;
    direction: rtl;
}

.bee1-fsc-title {
    background: var(--bee1-primary);
    color: white;
    padding: 22px 28px;
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.bee1-fsc-table-container {
    padding: 28px;
    overflow-x: auto;
}

.bee1-fsc-table {
    min-width: 100%;
}

.bee1-fsc-footer {
    background: #f8fafc;
    padding: 14px 28px;
    font-size: 0.875rem;
    color: var(--bee1-text-secondary);
    text-align: center;
    border-top: 1px solid var(--bee1-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    #bee1-fsc-table-editor {
        padding: 16px;
    }

    .bee1-fsc-wrapper {
        margin: 32px 0;
        border-radius: 12px;
    }

    .bee1-fsc-title {
        padding: 18px 20px;
        font-size: 1.2rem;
    }
}

/* WP Admin – override any admin theme that might inject white text */
#bee1-fsc-table-editor .button {
    border-radius: 8px;
    color: #171f3b !important;
}

/* Make sure table is RTL friendly */
#bee1-fsc-rows-table,
.bee1-fsc-table {
    direction: rtl;
}
