/* CSS Flexbox Generator Styles */

/* Form Elements */
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: white;
    font-size: 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Range Sliders */
.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #3b82f6 0%, #3b82f6 0%, #e5e7eb 0%, #e5e7eb 100%);
    outline: none;
    -webkit-appearance: none;
    transition: background 0.2s ease-in-out;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
}

.btn-outline {
    background: transparent;
    color: #6b7280;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
}

/* Preview Container */
.preview-container {
    border: 2px dashed #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 200px;
    max-height: 400px;
    background: #fafafa;
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.preview-container.desktop {
    max-width: 100%;
    width: 100%;
}

.preview-container.tablet {
    max-width: 768px;
    width: 768px;
    margin: 0 auto;
}

.preview-container.mobile {
    max-width: 375px;
    width: 375px;
    margin: 0 auto;
}

.flex-container-preview {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    min-height: 120px;
    max-height: 400px;
    width: 100%;
    max-width: 100%;
    transition: all 0.3s ease-in-out;
    position: relative;
    padding: 0.75rem;
    overflow: auto;
    box-sizing: border-box;
}

.flex-item {
    background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%);
    border: 1px solid #a78bfa;
    border-radius: 0.375rem;
    padding: 0.75rem;
    color: #5b21b6;
    font-weight: 500;
    text-align: center;
    min-height: 50px;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease-in-out;
    position: relative;
    cursor: pointer;
    font-size: 0.875rem;
}

.flex-item:hover {
    background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 100%);
    transform: scale(1.02);
}

.flex-item.selected {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: #d97706;
    color: #92400e;
}

/* Preview Mode Buttons */
.preview-mode-btn {
    background: transparent;
    color: #6b7280;
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.preview-mode-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.preview-mode-btn:hover:not(.active) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Code Sections */
.code-section {
    background: #1a1b26;
    border-radius: 0.5rem;
    overflow: hidden;
}

.code-header {
    background: #24283b;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #414868;
}

.code-label {
    color: #c0caf5;
    font-size: 0.875rem;
    font-weight: 500;
}

.copy-btn {
    background: #3d4259;
    color: #c0caf5;
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.copy-btn:hover {
    background: #565f7e;
}

.code-section pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto;
}

.code-section code {
    font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Code Tab Buttons */
.code-tab-btn {
    background: transparent;
    color: #6b7280;
    padding: 0.5rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.code-tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.code-tab-btn:hover:not(.active) {
    color: #374151;
}

/* Presets Grid */
.preset-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
}

.preset-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.preset-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.preset-description {
    color: #6b7280;
    font-size: 0.75rem;
    line-height: 1.4;
}

.preset-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
    height: 60px;
    margin: 0.75rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #64748b;
}

/* Item Controls */
.item-control {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.item-control h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-control select {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background: white;
    font-size: 0.75rem;
    margin-bottom: 0.375rem;
}

.item-control input[type="range"] {
    width: 100%;
    height: 4px;
}

/* Notifications */
.notification {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.notification.success {
    border-left: 4px solid #10b981;
}

.notification.error {
    border-left: 4px solid #ef4444;
}

.notification.info {
    border-left: 4px solid #3b82f6;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .preview-container {
        padding: 0.75rem;
        min-height: 150px;
    }

    .flex-container-preview {
        min-height: 100px;
        padding: 0.5rem;
    }

    .flex-item {
        padding: 0.5rem;
        min-height: 40px;
        min-width: 60px;
        font-size: 0.75rem;
    }

    .code-section pre {
        padding: 0.75rem;
    }

    .code-section code {
        font-size: 0.75rem;
    }
}

@media (max-width: 640px) {
    .btn-primary,
    .btn-secondary,
    .btn-outline {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .preview-mode-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.625rem;
    }

    .preset-card {
        padding: 0.75rem;
    }

    .item-control {
        padding: 0.5rem;
    }
}

/* Accessibility & Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
.btn-primary:focus,
.btn-secondary:focus,
.btn-outline:focus,
.form-select:focus,
.range-slider:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.flex-item:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
