/* ================ BASE STYLES ================ */
:root {
    --primary: #4361ee;
    --primary-light: #e0e7ff;
    --secondary: #3f37c9;
    --success: #4cc9f0;
    --info: #4895ef;
    --warning: #f8961e;
    --danger: #f72585;
    --dark: #212529;
    --light: #f8f9fa;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    
    --text-primary: #2b2d42;
    --text-secondary: #6c757d;
    --border-color: #e9ecef;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: #f5f7fa;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ================ NAVBAR ================ */
.navbar {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

.navbar-brand i {
    margin-right: 0.5rem;
    font-size: 1.5rem;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-link {
    padding: 0.5rem 1rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.navbar-link:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--secondary);
    border-color: var(--secondary);
}

.btn-secondary {
    background-color: var(--light-gray);
    color: var(--text-primary);
    border-color: var(--light-gray);
}

.btn-secondary:hover {
    background-color: #d1d7e0;
    border-color: #d1d7e0;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-light);
}

.btn-danger {
    background-color: #fff0f3;
    border-color: #fff0f3;
    color: var(--danger);
}

.btn-danger:hover {
    background-color: #ffd6e0;
    border-color: #ffd6e0;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition);
}

.user-btn:hover {
    background-color: var(--light-gray);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 100;
}

.user-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    transition: var(--transition);
    gap: 0.75rem;
}

.dropdown-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

/* ================ BUILDER CONTAINER ================ */
.builder-container {
    padding: 2rem 0;
}

.builder-header {
    margin-bottom: 2rem;
    text-align: center;
}

.builder-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.builder-header p {
    color: var(--gray);
    font-size: 1rem;
}

/* Tabs */
.builder-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray);
    position: relative;
    transition: var(--transition);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background-color: var(--light-gray);
}

.tab-btn.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Sections */
.form-section {
    background-color: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

.form-section-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--light-gray);
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.hint {
    display: block;
    margin-top: 0.25rem;
    color: var(--gray);
    font-size: 0.85rem;
}

/* File Upload */
.file-upload {
    position: relative;
    display: flex;
    flex-direction: column;
}

.file-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background-color: var(--light-gray);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    gap: 0.5rem;
}

.file-upload-label:hover {
    background-color: #e0e5ec;
}

.file-name {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--gray);
}

/* Dynamic Items */
.dynamic-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px dashed var(--light-gray);
}

.add-item-btn {
    width: 100%;
    margin-top: 0.5rem;
}

.remove-item-btn {
    margin-top: 1rem;
}

/* Chips */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--light-gray);
    border-radius: 6px;
    min-height: 44px;
}

.chip {
    display: inline-flex;
    align-items: center;
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    gap: 0.5rem;
}

.chip-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
}

/* Preview Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-container {
    position: relative;
    background-color: white;
    border-radius: 10px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray);
    font-size: 1.5rem;
    padding: 0.5rem;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--light-gray);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.preview-container {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0 1rem;
    }
    
    .navbar-menu {
        gap: 0.5rem;
    }
    
    .user-btn span {
        display: none;
    }
    
    .builder-header h1 {
        font-size: 1.5rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        max-height: 80vh;
    }
}

@media (max-width: 576px) {
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}