/* Layout Selector Modal */
.layout-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.layout-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.layout-modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

.layout-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.layout-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.layout-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.layout-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.layout-modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Tabs */
.layout-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0 20px;
}

.layout-tab {
    background: none;
    border: none;
    padding: 15px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    margin-right: 5px;
    transition: all 0.3s ease;
    position: relative;
}

.layout-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.layout-tab.active {
    background: white;
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

/* Content */
.layout-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

/* Layout Templates */
.layout-template {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.layout-template:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.layout-template.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.layout-template.selected::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #667eea;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.layout-template.currently-applied {
    border-color: #28a745;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.05) 100%);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.15);
}

.layout-template.currently-applied::after {
    content: '🔥 Đang sử dụng';
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layout-preview-thumb {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border: 1px solid #dee2e6;
    overflow: hidden;
    padding: 8px;
}

.layout-preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.layout-shape-preview {
    position: relative;
    background: white;
    border: 2px solid #667eea;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    max-width: 100%;
    max-height: 100%;
    min-width: 60px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-shape-icon {
    font-size: 1.5rem;
    opacity: 0.8;
    z-index: 2;
    position: relative;
}

.layout-shape-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(to right, rgba(102, 126, 234, 0.1) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(102, 126, 234, 0.1) 1px, transparent 1px);
    background-size: 12px 12px;
    border-radius: 2px;
    opacity: 0.6;
}

.layout-info {
    text-align: center;
}

.layout-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
    font-size: 14px;
}

.layout-size {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 2px;
}

.layout-ratio {
    font-size: 11px;
    color: #adb5bd;
    font-style: italic;
}

/* Footer */
.layout-modal-footer {
    padding: 20px 30px;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-radius: 0 0 20px 20px;
}

.layout-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.layout-btn-secondary {
    background: #6c757d;
    color: white;
}

.layout-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.layout-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.layout-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.layout-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .layout-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .layout-modal-header,
    .layout-modal-footer {
        padding: 15px 20px;
    }
    
    .layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .layout-tabs {
        padding: 0 10px;
        flex-wrap: wrap;
    }
    
    .layout-tab {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .layout-preview-thumb {
        height: 100px;
        padding: 6px;
    }
    
    .layout-shape-preview {
        min-width: 50px;
        min-height: 35px;
    }
    
    .layout-shape-icon {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .layout-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .layout-template {
        padding: 10px;
    }
    
    .layout-preview-thumb {
        height: 80px;
        padding: 4px;
    }
    
    .layout-shape-preview {
        min-width: 40px;
        min-height: 30px;
    }
    
    .layout-shape-icon {
        font-size: 1.1rem;
    }
    
    .layout-name {
        font-size: 12px;
    }
    
    .layout-size {
        font-size: 11px;
    }
    
    .layout-ratio {
        font-size: 10px;
    }
} 