/* Hide sidebar on stamp page, make content full-width */
.page-content:has(#stamp-calc-app) { width: 100% !important; float: none !important; }
.page-content:has(#stamp-calc-app) + .sidebar { display: none !important; }
/* Fallback for browsers without :has() */
#stamp-calc-app { margin: 20px 0; }
.stc-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) {
    .stc-layout { grid-template-columns: 1fr; }
    .stc-price { position: static; }
}
@media (max-width: 600px) {
    .stc-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
        gap: 4px;
    }
    .stc-frame-img { width: 40px !important; height: 40px !important; }
    .stc-form, .stc-price { padding: 14px; }
}
.stc-form, .stc-price {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
}
.stc-price {
    position: sticky !important;
    top: 20px !important;
    max-height: calc(100vh - 40px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.stc-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: #333;
}
.stc-group { margin-bottom: 16px; }
.stc-group > label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #444;
    font-size: 0.95rem;
}
.stc-group input,
.stc-group select,
.stc-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
}
.stc-group input:focus,
.stc-group select:focus,
.stc-group textarea:focus {
    outline: none;
    border-color: #5a7c3a;
    box-shadow: 0 0 0 2px rgba(90, 124, 58, 0.2);
}
.stc-group textarea {
    resize: vertical;
    min-height: 70px;
}

/* Frame list */
.stc-frames {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 300px;
    overflow-y: auto;
}
.stc-frame {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    border: 2px solid #e5e5e5 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.15s !important;
    background: #fff !important;
    margin: 0 !important;
    text-align: left !important;
}
.stc-frame:hover { background: #f5f5f0 !important; border-color: #bbb !important; }
.stc-frame.selected { border-color: #5a7c3a !important; background: #f0f5eb !important; }
.stc-frame-img {
    width: 50px !important;
    height: 50px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
    border-radius: 4px !important;
    background: #f9f9f9 !important;
}
.stc-frame input[type="radio"] {
    flex-shrink: 0 !important;
    accent-color: #5a7c3a !important;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    appearance: auto !important;
    -webkit-appearance: radio !important;
}
.stc-frame-info { flex: 1 !important; min-width: 0 !important; display: block !important; }
.stc-frame-model { font-weight: 600 !important; color: #333 !important; font-size: 0.95rem !important; }
.stc-frame-brand { font-size: 0.8rem !important; color: #888 !important; }
.stc-frame-size { font-size: 0.85rem !important; color: #555 !important; display: block !important; }
.stc-frame-price { font-weight: 600 !important; color: #5a7c3a !important; white-space: nowrap !important; font-size: 0.95rem !important; }

/* Thumbnail grid */
.stc-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
}
.stc-thumb {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.15s;
    background: #fff;
}
.stc-thumb:hover { border-color: #bbb; }
.stc-thumb.selected { border-color: #5a7c3a; box-shadow: 0 0 0 2px rgba(90, 124, 58, 0.3); }
.stc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
}
.stc-thumb-id {
    position: absolute;
    bottom: 1px;
    right: 3px;
    font-size: 0.6rem;
    color: #aaa;
}
.stc-clear {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #5a7c3a;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    text-decoration: underline;
}

/* Price */
.stc-total {
    background: #5a7c3a;
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 14px;
}
.stc-total-label { font-size: 0.95rem; opacity: 0.9; }
.stc-total-value { font-size: 2.2rem; font-weight: 700; }
.stc-breakdown { font-size: 0.85rem; color: #666; margin-bottom: 14px; }
.stc-breakdown div { display: flex; justify-content: space-between; padding: 3px 0; }
.stc-loading, .stc-calculating { text-align: center; padding: 30px; color: #888; }
.stc-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #5a7c3a;
    border-radius: 50%;
    animation: stcSpin 0.8s linear infinite;
    margin: 0 auto 10px;
}
@keyframes stcSpin { to { transform: rotate(360deg); } }
.stc-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px;
    color: #991b1b;
    margin-bottom: 12px;
    font-size: 0.9rem;
}
.stc-success {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 12px;
    color: #065f46;
    margin-bottom: 12px;
    font-size: 0.9rem;
}
.stc-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.stc-btn-disabled { background: #ccc; color: #fff; cursor: not-allowed; }
.stc-btn-cart { background: #5a7c3a; color: #fff; }
.stc-btn-cart:hover { background: #4a6a2e; }
.stc-btn-login { background: #d4760a; color: #fff; }
.stc-btn-login:hover { background: #b5640a; }
.stc-btn-goto-cart { background: #2563eb !important; color: #fff !important; display: block !important; text-align: center !important; text-decoration: none !important; box-sizing: border-box !important; padding: 12px !important; border-radius: 6px !important; font-size: 1rem !important; font-weight: 600 !important; margin-bottom: 10px !important; }
.stc-btn-goto-cart:hover { background: #1d4ed8 !important; }
.stc-hint {
    margin-top: 8px;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}
.stc-placeholder {
    background: #f5f5f0;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    color: #888;
}
.stc-org-selector {
    background: #f0f5eb;
    border: 1px solid #c5d8b5;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}
.stc-org-selector label { color: #3a5a20; font-weight: 500; margin-bottom: 6px; display: block; font-size: 0.9rem; }
.stc-org-selector select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #a5c88a;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
}
.stc-user-info {
    background: #f0f5eb;
    border: 1px solid #c5d8b5;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #3a5a20;
}

/* Org creation form (inline in price block) */
.stc-org-form {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
}
.stc-org-form-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}
.stc-org-type-group {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.stc-org-type-item {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 6px 8px !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 0.8rem !important;
    transition: all 0.15s !important;
    white-space: nowrap !important;
    background: #fff !important;
    margin: 0 !important;
}
.stc-org-type-item:hover { background: #f0f5eb !important; }
.stc-org-type-item.selected { border-color: #5a7c3a !important; background: #f0f5eb !important; }
.stc-org-type-item input[type="radio"] {
    accent-color: #5a7c3a !important;
    margin: 0 !important;
    width: 14px !important;
    height: 14px !important;
    appearance: auto !important;
    -webkit-appearance: radio !important;
}
.stc-org-field { margin-bottom: 8px; position: relative; }
.stc-org-input {
    width: 100% !important;
    padding: 8px 10px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    background: #fff !important;
    height: auto !important;
    line-height: normal !important;
    margin: 0 !important;
}
.stc-org-input:focus {
    outline: none !important;
    border-color: #5a7c3a !important;
    box-shadow: 0 0 0 2px rgba(90, 124, 58, 0.15) !important;
}
.stc-org-inn-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
}
.stc-org-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 180px;
    overflow-y: auto;
    z-index: 10;
    margin-top: 2px;
}
.stc-org-suggest-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    border-bottom: 1px solid #f3f4f6;
}
.stc-org-suggest-item:hover { background: #f0f5eb; }
.stc-org-suggest-item:last-child { border-bottom: none; }
.stc-org-suggest-item small { color: #9ca3af; }
.stc-btn-org-create { background: #5a7c3a !important; color: #fff !important; }
.stc-btn-org-create:hover { background: #4a6a2e !important; }
