/* LR Builder Calendar v3.0.0
   ─────────────────────────────────────────────────── */

/* ── Wrapper ─────────────────────────────────────── */
.lrbc-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ── Calendar Section ────────────────────────────── */
.lrbc-cal-section {
    position: relative;
    margin-bottom: 28px;
}

.lrbc-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    z-index: 10;
}

.lrbc-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid rgba(0,0,0,0.08);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: lrbcspin 0.9s linear infinite;
}
@keyframes lrbcspin { to { transform: rotate(360deg); } }

.lrbc-loading-text {
    font-size: 14px;
    color: #4b5563;
}

.lrbc-cal {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

/* ── Materials Panel ─────────────────────────────── */
.lrbc-materials-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
}

.lrbc-mats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
    background: #1e3a5f;
    color: #fff;
}

.lrbc-mats-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
}

.lrbc-mats-title svg {
    opacity: 0.85;
    flex-shrink: 0;
}

/* Year navigation */
.lrbc-year-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lrbc-year-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.lrbc-year-btn:hover {
    background: rgba(255,255,255,0.28);
}

.lrbc-year-label {
    font-size: 16px;
    font-weight: 700;
    min-width: 44px;
    text-align: center;
}

.lrbc-mats-body {
    padding: 20px;
}

.lrbc-mats-loading,
.lrbc-mats-empty {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    padding: 24px 0;
}

.lrbc-mats-category + .lrbc-mats-category {
    margin-top: 18px;
}

.lrbc-mats-cat-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 10px;
}

/* Material cards grid */
.lrbc-mats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.lrbc-mat-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 12px 12px;
    text-align: center;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.lrbc-mat-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37,99,235,0.1);
}

.lrbc-mat-total {
    font-size: 28px;
    font-weight: 800;
    color: #1e3a5f;
    line-height: 1.1;
}

.lrbc-mat-unit {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 2px 0 4px;
}

.lrbc-mat-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.lrbc-mats-footer {
    padding: 0 20px 14px;
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
}

/* ── Date Change CTA ─────────────────────────────── */
.lrbc-cta-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 28px;
}

.lrbc-cta-text {
    font-size: 14px;
    color: #1e3a5f;
    line-height: 1.5;
}
.lrbc-cta-text strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}
.lrbc-cta-text a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}
.lrbc-cta-text a:hover {
    text-decoration: underline;
}

.lrbc-cta-btn {
    white-space: nowrap;
    padding: 11px 20px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.lrbc-cta-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* ── Modal ───────────────────────────────────────── */
.lrbc-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 9999;
}
.lrbc-modal.open {
    display: block;
}
.lrbc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.lrbc-modal-dialog {
    position: relative;
    max-width: 520px;
    margin: 8vh auto 0;
    background: #fff;
    border-radius: 14px;
    padding: 22px 22px 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.22);
    max-height: 85vh;
    overflow-y: auto;
}
.lrbc-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
}
.lrbc-modal-close:hover {
    color: #111827;
}
.lrbc-modal-heading {
    margin: 0 0 14px;
    font-size: 18px;
    color: #1e3a5f;
}

/* Event summary block */
.lrbc-event-summary {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 14px;
}
.lrbc-s-row { margin: 3px 0; }

.lrbc-note-warning {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #7c2d12;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 10px 0;
    font-size: 13px;
}

/* Form */
.lrbc-field { margin-bottom: 12px; }
.lrbc-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}
.lrbc-field label span { color: #dc2626; }
.lrbc-field input,
.lrbc-field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.lrbc-field input:focus,
.lrbc-field textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.lrbc-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.lrbc-btn {
    padding: 10px 18px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.lrbc-btn:hover   { background: #1d4ed8; }
.lrbc-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.lrbc-btn.ghost   { background: #f3f4f6; color: #374151; }
.lrbc-btn.ghost:hover { background: #e5e7eb; }

.lrbc-form-status {
    margin-top: 8px;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 6px;
}
.lrbc-form-status:empty { display: none; }

/* Error / empty states */
.lrbc-error {
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
    font-size: 14px;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 600px) {
    .lrbc-mats-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .lrbc-mat-total { font-size: 22px; }
    .lrbc-cta-section { flex-direction: column; align-items: flex-start; }
    .lrbc-cta-btn { width: 100%; text-align: center; }
    .lrbc-modal-dialog { margin: 0; border-radius: 14px 14px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-height: 90vh; }
}
