/**
 * SG Bookings — Frontend Styles
 * Scoped to .sgb-root to avoid conflicts with WordPress themes.
 * @package SG_Bookings
 */

/* ─── Root scope & reset ─── */
.sgb-root { box-sizing: border-box; font-family: 'Raleway', 'Segoe UI', sans-serif; color: #333; }
.sgb-root *, .sgb-root *::before, .sgb-root *::after { box-sizing: border-box; }

/* ─── Form container ─── */
.sgb-root.sgb-form { max-width: 720px; margin: 0 auto; padding: 10px 0; }

/* ─── Sections ─── */
.sgb-root .sgb-section { margin-bottom: 24px; }

.sgb-root .sgb-section-title {
    color: #337157;
    font-family: 'Cinzel', 'Georgia', serif;
    font-weight: 500;
    font-size: 18px;
    margin-bottom: 10px;
}

/* ─── Field groups (2-col grid) ─── */
.sgb-root .sgb-field-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.sgb-root .sgb-field-group input,
.sgb-root .sgb-field-group select {
    flex: 1;
}

/* ─── Inputs ─── */
.sgb-root input[type="text"],
.sgb-root input[type="email"],
.sgb-root input[type="tel"],
.sgb-root select,
.sgb-root textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Raleway', sans-serif;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}
.sgb-root input:focus,
.sgb-root select:focus,
.sgb-root textarea:focus {
    outline: none;
    border-color: #337157;
    box-shadow: 0 0 0 2px rgba(51, 113, 87, 0.15);
}

.sgb-root textarea {
    min-height: 100px;
    resize: vertical;
}

/* ─── Labels ─── */
.sgb-root label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.sgb-root .sgb-sublabel {
    display: block;
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    color: #666;
    margin-bottom: 6px;
}

/* ─── Diamond fields (readonly) ─── */
.sgb-root .sgb-diamond-field input {
    background-color: #f5f5f5;
    cursor: default;
}

/* ═══════ Calendar ═══════ */
.sgb-root .sgb-calendar-wrapper {
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff;
}

.sgb-root .sgb-calendar-wrapper header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sgb-root .sgb-current-date {
    font-size: 16px;
    font-weight: 600;
    color: #337157;
    margin: 0;
}

.sgb-root .sgb-icons {
    display: flex;
    gap: 10px;
}

.sgb-root .sgb-nav-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    font-size: 20px;
    color: #337157;
    transition: background 0.2s;
    user-select: none;
}
.sgb-root .sgb-nav-icon:hover {
    background: rgba(51, 113, 87, 0.1);
}

/* Calendar grid */
.sgb-root .sgb-calendar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sgb-root .sgb-weeks {
    display: flex;
}
.sgb-root .sgb-weeks li {
    flex: 1;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    padding: 8px 0;
}

.sgb-root .sgb-days {
    display: flex;
    flex-wrap: wrap;
}
.sgb-root .sgb-days li {
    width: calc(100% / 7);
    text-align: center;
    padding: 8px 0;
    cursor: pointer;
    position: relative;
    z-index: 1;
    font-size: 14px;
    border-radius: 50%;
    transition: color 0.2s;
}

.sgb-root .sgb-days li:hover:not(.sgb-inactive):not(.sgb-non-selectable) {
    color: #337157;
    font-weight: 600;
}

/* Active / selected day */
.sgb-root .sgb-days li.sgb-active {
    color: #fff;
}
.sgb-root .sgb-days li.sgb-active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    background: #337157;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
}

/* Inactive (past days or other month) */
.sgb-root .sgb-days li.sgb-inactive {
    color: #ccc;
    cursor: default;
}

/* Non-selectable (closed days & bank holidays) */
.sgb-root .sgb-days li.sgb-non-selectable {
    color: #d4d4d4;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* ─── Submit button ─── */
.sgb-root button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: #337157;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Raleway', sans-serif;
    margin-top: 10px;
}
.sgb-root button[type="submit"]:hover {
    background: #2a5c47;
}

/* ─── Messages ─── */
.sgb-root .sgb-message {
    background: #d4edda;
    color: #155724;
    padding: 14px 20px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    margin-top: 16px;
}

.sgb-root .sgb-error {
    background: #f8d7da;
    color: #721c24;
    padding: 14px 20px;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    margin-top: 16px;
}

/* ─── Spinner ─── */
.sgb-root .sgb-spinner {
    margin: 20px auto;
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #337157;
    border-radius: 50%;
    animation: sgb-spin 0.8s linear infinite;
}

@keyframes sgb-spin {
    to { transform: rotate(360deg); }
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
    .sgb-root .sgb-field-group {
        flex-direction: column;
        gap: 0;
    }
}

/* ─── NivoSync Modal Integration ─── */
.ns-modal .sgb-root.sgb-form {
    max-width: none;
    padding: 0;
}
.ns-modal .sgb-root .sgb-section-title {
    font-size: 1rem;
    margin-top: 0.5rem;
}
.ns-modal .sgb-root .sgb-calendar-wrapper {
    max-width: 100%;
}
