/**
 * POD Designer Module - Styles
 * Design as Wish - Material Library & Designer Interface
 */

:root {
    --primary: #AA2B3A;
    --primary-dark: #8a1f2e;
    --text: #28314E;
    --text-light: #5A6278;
    --bg: #FFF8F0;
    --bg-white: #FFFFFF;
    --border: #E5E7EB;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --overlay: rgba(0, 0, 0, 0.7);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 4px;
}

.logo p {
    font-size: 14px;
    color: var(--text-light);
}

.header-nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--primary);
}

/* Filters Section */
.filters-section {
    background: var(--bg-white);
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.filters {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.filter-select {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-white);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--primary);
    outline: none;
}

.tags-filter {
    display: flex;
    gap: 8px;
}

.tag-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-white);
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.tag-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tag-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-input {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    width: 300px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(170, 43, 58, 0.1);
}

/* Materials Gallery */
.materials-gallery {
    padding: 48px 0;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.gallery-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 36px;
    color: var(--text);
}

.gallery-stats {
    font-size: 16px;
    color: var(--text-light);
}

.gallery-stats span {
    font-weight: 600;
    color: var(--primary);
    font-size: 20px;
}

/* Masonry Grid */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

@media (min-width: 768px) {
    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (min-width: 1200px) {
    .masonry-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* Material Card */
.material-card {
    background: var(--bg-white);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px var(--shadow);
}

.material-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px var(--shadow-lg);
}

.material-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 125%; /* 4:5 ratio */
    overflow: hidden;
    background: linear-gradient(135deg, #f5e6d3, #e8d5c4);
}

.material-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.material-card:hover .material-image {
    transform: scale(1.05);
}

.material-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.material-card:hover .material-overlay {
    opacity: 1;
}

.btn-design {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-design:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(170, 43, 58, 0.4);
}

.material-info {
    padding: 20px;
}

.material-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    line-height: 1.4;
}

.material-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.material-tags .tag {
    padding: 4px 12px;
    background: var(--bg);
    color: var(--text-light);
    font-size: 12px;
    border-radius: 12px;
}

/* Loading Indicator */
.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator p {
    margin-top: 16px;
    color: var(--text-light);
    font-size: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-light);
}

.empty-state p {
    font-size: 18px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-white);
    border-radius: 24px;
    padding: 48px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg);
    border: none;
    font-size: 28px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close:hover {
    background: var(--border);
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    align-items: center;
}

.material-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
}

.modal-title h3 {
    font-size: 24px;
    color: var(--text);
    margin-bottom: 8px;
}

.modal-title p {
    font-size: 16px;
    color: var(--text-light);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--bg);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.product-card:hover {
    background: var(--bg-white);
    box-shadow: 0 8px 20px var(--shadow);
    transform: translateY(-4px);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 16px;
    border-radius: 12px;
}

.product-info h4 {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 12px;
}

.product-features {
    list-style: none;
    text-align: left;
    margin-top: 12px;
}

.product-features li {
    font-size: 13px;
    color: var(--text-light);
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.product-features li:before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* Designer Modal */
.designer-modal .modal-content {
    max-width: 95vw;
    width: 95vw;
    max-height: 95vh;
    padding: 0;
}

.designer-content {
    display: flex;
    flex-direction: column;
    height: 95vh;
}

.designer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
}

.designer-header h3 {
    font-size: 20px;
    color: var(--text);
}

.designer-actions {
    display: flex;
    gap: 12px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(170, 43, 58, 0.3);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
}

.designer-frame-container {
    flex: 1;
    overflow: hidden;
    background: #f5f5f5;
}

.designer-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* Designer Modal Styles */
.designer-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.designer-modal-content {
    background: white;
    border-radius: 16px;
    width: 95vw;
    height: 95vh;
    max-width: 1600px;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal Header */
.designer-modal-content .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    border-bottom: 1px solid var(--border);
    background: white;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h2 {
    font-size: 20px;
    color: var(--text);
    margin: 0;
}

.material-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg);
    border-radius: 8px;
}

.material-info img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.material-info span {
    font-size: 14px;
    color: var(--text-light);
}

.header-right {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text);
}

.btn-icon:hover {
    background: var(--border);
    transform: scale(1.05);
}

/* Modal Body */
.designer-modal-content .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: #f5f5f5;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-overlay .spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay p {
    margin-top: 20px;
    font-size: 16px;
    color: var(--text);
    font-weight: 600;
}

/* SDK Container */
.sdk-container {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

.design-box {
    flex: 2;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--border);
    overflow: hidden;
}

.preview-box {
    flex: 1;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--border);
    overflow: hidden;
    min-width: 300px;
}

/* Control Panel */
.control-panel {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
    justify-content: center;
}

.control-group {
    display: flex;
    gap: 8px;
}

.control-btn {
    padding: 8px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.control-btn:hover {
    background: var(--bg-white);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

/* Modal Footer */
.designer-modal-content .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    background: white;
}

.footer-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.footer-info span {
    font-size: 14px;
    color: var(--text-light);
}

.footer-info .status-success {
    color: #10b981;
    font-weight: 600;
}

.footer-info .status-error {
    color: #ef4444;
    font-weight: 600;
}

.footer-actions {
    display: flex;
    gap: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .filters {
        flex-direction: column;
        gap: 16px;
    }

    .filter-group {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 24px;
    }

    .gallery-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .gallery-header h2 {
        font-size: 28px;
    }

    .masonry-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .modal-content {
        padding: 32px 24px;
        width: 95%;
    }

    .modal-header {
        flex-direction: column;
        text-align: center;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .designer-content {
        height: 90vh;
    }

    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 12px 0;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo p {
        font-size: 12px;
    }

    .filters-section {
        padding: 16px 0;
    }

    .materials-gallery {
        padding: 24px 0;
    }

    .btn-design {
        padding: 10px 24px;
        font-size: 14px;
    }

    /* Designer Modal Responsive */
    .sdk-container {
        flex-direction: column;
    }

    .preview-box {
        min-width: auto;
        height: 200px;
    }

    .control-panel {
        flex-wrap: wrap;
        gap: 8px;
    }

    .designer-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
}
