/* --- Variant Controls in Modal --- */
.variants-title {
    font-size: 1.4rem;
    margin: 1.5rem 0 0.5rem;
    color: var(--accent);
}

.save-btn {
    background: #2d8f4e;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s;
}

.save-btn:hover {
    background: #3aaf62;
}

.action-btn {
    background: var(--bg-panel-hover);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent);
}

.variants-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.variant-row {
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    transition: border-color 0.2s;
}

.variant-row.dirty {
    border-color: #f0ad4e;
}

.variant-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.variant-badge {
    background: var(--accent-hover);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

.variant-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.qty-btn {
    width: 30px;
    height: 30px;
    background: var(--bg-panel-hover);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.qty-btn:hover {
    background: var(--accent-hover);
}

.qty-input {
    width: 50px;
    text-align: center;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 6px;
    border-radius: 6px;
    font-family: inherit;
}

.cond-select {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 6px 8px;
    border-radius: 6px;
    font-family: inherit;
    min-width: 100px;
}

.notes-input {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 6px 8px;
    border-radius: 6px;
    font-family: inherit;
    flex: 1;
    min-width: 80px;
}

.save-status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    min-height: 1.2em;
}

.save-status.saving { color: var(--accent); }
.save-status.success { color: #3aaf62; }
.save-status.error { color: #ff6b6b; }

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    display: flex;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: scale(1);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}

.close-btn:hover {
    background: #ff6b6b;
}

.modal-body {
    display: flex;
    width: 100%;
    padding: 2rem;
    gap: 2rem;
}

.modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 50%;
}

.modal-image-container img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.modal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 80vh;
}

.modal-info h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: -webkit-linear-gradient(var(--accent), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.badge {
    background: var(--bg-panel-hover);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--accent-hover);
}

.flavor-text {
    font-style: italic;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    border-left: 3px solid var(--accent-hover);
    padding-left: 1rem;
}

.artist {
    font-size: 0.9rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.price-table th, .price-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.price-table th {
    font-weight: 600;
    color: var(--accent);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.price-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.price-modal-content {
    max-width: 900px;
    padding: 2rem;
    flex-direction: column;
}

.price-subtitle {
    color: #ccc;
    font-size: 0.95rem;
    margin-top: 4px;
}

.price-info {
    color: #3498db;
    font-size: 0.9rem;
    margin-top: 8px;
}

.price-table-container {
    margin-top: 1rem;
    overflow-x: auto;
    max-height: 400px;
}

.price-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 10px;
}

.price-close-action {
    margin-left: auto;
}

.modal-action-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.modal-action-row .save-btn,
.modal-action-row .action-btn {
    flex: 1;
}

.share-modal-content {
    max-width: 520px;
}

.share-modal-body {
    display: grid;
    gap: 0.85rem;
    padding: 1.5rem;
}

.share-modal-body h2,
.share-modal-body p {
    margin: 0;
}

.share-modal-body p,
.share-link-status {
    color: var(--text-muted);
}

.share-modal-body label {
    font-weight: 800;
}

#share-link-input {
    width: 100%;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    padding: 0.85rem;
}

#share-link-input::selection {
    background: #bfe3ff;
    color: #111827;
}

.share-modal-body .modal-action-row {
    margin-bottom: 0;
}

.share-modal-body .modal-action-row .save-btn,
.share-modal-body .modal-action-row .action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    margin-bottom: 0;
    padding: 0 1rem;
}

.price-check-btn,
.go-to-set-btn {
    padding: 8px 20px;
    margin-bottom: 1rem;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.price-check-btn {
    background: #2980b9;
}

.go-to-set-btn {
    background: #16a34a;
}

.price-empty-row {
    text-align: center;
    padding: 20px;
}

.price-error-row {
    text-align: center;
    color: #e74c3c;
    padding: 20px;
}

@media (max-width: 768px) {
    #app-view {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    .modal-body {
        flex-direction: column;
        overflow-y: auto;
    }
    .modal-image-container {
        max-width: 100%;
    }
}
