/* Component-specific styles */

/* Profit Margin Selector */
.profit-margin-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px !important;
}

.profit-margin-selector {
    display: flex;
    align-items: center;
    gap: 5px;
}

#profitMarginInput {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    text-align: center;
}

#profitMarginInput::-webkit-inner-spin-button,
#profitMarginInput::-webkit-outer-spin-button {
    opacity: 1;
    height: 20px;
}

.apply-margin-btn {
    padding: 4px 12px;
    background: linear-gradient(135deg, #4a9eff, #0066cc);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.apply-margin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: block !important;
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s;
}

.modal-header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-radius: 0 0 8px 8px;
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: color 0.2s;
}

.close:hover,
.close:focus {
    color: var(--text-primary);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Profile Builder */
.profile-btn {
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-btn-user {
    background: linear-gradient(135deg, #4a9eff, #0066cc);
}

.profile-btn-user:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.4);
}

.profile-btn-business {
    background: linear-gradient(135deg, #00c896, #00a67e);
}

.profile-btn-business:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 200, 150, 0.4);
}

.profile-btn-more {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.profile-btn-more:hover {
    background: var(--bg-hover);
}

.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 150px;
}

.profile-dropdown-item {
    width: 100%;
    padding: 10px 15px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.profile-dropdown-item:hover {
    background: var(--bg-hover);
}

/* Pending Memories */
.pending-memories {
    max-height: 260px;
    overflow-y: auto;
    padding: 12px;
}

.no-memories {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 13px;
}

/* Bulk Actions */
.bulk-actions {
    padding: 8px;
    border-top: 1px solid var(--border-color);
    display: none;
    min-height: 55px;
}

.bulk-actions-row {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.bulk-actions-row:last-child {
    margin-bottom: 0;
}

.bulk-btn {
    flex: 1;
    padding: 6px 4px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.bulk-btn-user {
    background: linear-gradient(135deg, #4a9eff, #0066cc);
}

.bulk-btn-business {
    background: linear-gradient(135deg, #00c896, #00a67e);
}

.bulk-btn-events {
    background: linear-gradient(135deg, #ffa726, #ff9800);
}

.bulk-btn-new {
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
}

.bulk-btn-skip {
    background: #444;
    color: #aaa;
    border: 1px solid #555;
}

/* Approved Designs */
.approved-designs {
    max-height: 500px;
    overflow-y: auto;
    padding: 12px;
    border: 2px dashed transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.approved-designs.drag-over {
    border-color: var(--accent-primary);
    background-color: rgba(139, 92, 246, 0.05);
}

.design-count {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.no-designs {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 13px;
}

.panel-toggle-btn {
    margin-left: auto;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.panel-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* Shopify Panel */
.shopify-content {
    padding: 12px;
    min-height: auto;
}

.shopify-status {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.shopify-action-btn-container {
    margin-bottom: 12px;
}

.shopify-action-btn {
    width: 100%;
    padding: 10px;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.shopify-action-btn:hover {
    transform: translateY(-2px);
}

.shopify-btn-analyze {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.shopify-btn-analyze:hover {
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.shopify-btn-optimize {
    background: linear-gradient(135deg, #10b981, #059669);
}

.shopify-btn-optimize:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.shopify-btn-preview {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.shopify-btn-preview:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Shopify Auto Toggle */
.shopify-auto-section {
    margin-bottom: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.shopify-auto-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.shopify-auto-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #444;
    transition: .4s;
    border-radius: 24px;
}

.toggle-knob {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent-primary);
}

input:checked + .toggle-slider .toggle-knob {
    transform: translateX(24px);
}

.shopify-auto-status {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Shopify Stats */
.shopify-stats-section {
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.shopify-stats-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.shopify-stats {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Future Placeholder */
.shopify-future-placeholder {
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
    text-align: center;
}

.shopify-future-text {
    font-size: 11px;
    color: var(--text-tertiary);
    opacity: 0.7;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a1a3a 100%);
    margin: 5% auto;
    padding: 0;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    width: 80%;
    max-width: 1200px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.2);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
}

.close {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--accent-primary);
}

.modal-info {
    margin-bottom: 20px;
}

.design-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.design-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 200px);
}

/* Design Library Modal specific styling */
#designLibraryModal .modal-content {
    padding: 20px;
}

#designLibraryModal .modal-header {
    padding: 0 0 15px 0;
    margin-bottom: 15px;
    flex-shrink: 0;
}

#designLibraryModal .modal-info {
    flex-shrink: 0;
    margin-bottom: 15px;
}

#designLibraryModal .design-grid {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.design-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: visible;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 280px;
}

.design-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.design-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-card);
}

.design-info {
    padding: 12px;
}

.design-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.design-size {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-bottom: 12px;
}

.design-actions {
    display: flex;
    gap: 8px;
}

.design-action-btn {
    flex: 1;
    padding: 6px 12px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.design-action-btn:hover {
    background: var(--accent-secondary);
}

/* Custom Scrollbar for Design Library */
#designLibraryModal .design-grid::-webkit-scrollbar {
    width: 10px;
}

#designLibraryModal .design-grid::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

#designLibraryModal .design-grid::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 5px;
}

#designLibraryModal .design-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Template Studio Modal Scrolling */
#templateStudioModal .modal-content {
    display: flex;
    flex-direction: column;
}

#templateStudioModal #templateStudioGrid {
    overflow-y: auto;
    max-height: calc(80vh - 300px);
}

#templateStudioModal #templateStudioGrid::-webkit-scrollbar {
    width: 10px;
}

#templateStudioModal #templateStudioGrid::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

#templateStudioModal #templateStudioGrid::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 5px;
}

#templateStudioModal #templateStudioGrid::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}