/* Main Site Styles */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #50C878;
    --danger-color: #E74C3C;
    --text-color: #333;
    --border-color: #ddd;
    --background-color: #f5f5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

.main-nav {
    padding: 15px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.logo:hover {
    color: white;
    opacity: 0.9;
}

.logo-icon {
    font-size: 28px;
}

.nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Navigation Buttons */
.btn-nav {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white !important;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-nav:hover,
.btn-nav:focus {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: white !important;
}

.btn-nav .nav-icon {
    margin-right: 6px;
}

/* Bootstrap Dropdown Customization */
.dropdown-menu {
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 6px;
    margin-top: 8px;
    min-width: 200px;
}

.dropdown-item {
    padding: 10px 16px;
    border-radius: 6px;
    color: #333;
    font-size: 15px;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dropdown-item:active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Page Header */
.page-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e9f2 100%);
    border-radius: 15px;
}

.page-title {
    font-size: 42px;
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 700;
}

.title-icon {
    font-size: 48px;
}

.page-subtitle {
    font-size: 18px;
    color: #718096;
    margin: 0;
}

/* Typography */
h1 {
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: var(--text-color);
    margin-bottom: 20px;
    font-size: 1.8em;
}

h3 {
    margin-bottom: 15px;
    font-size: 1.3em;
}

/* Forms */
.form-container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.generator-section {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.form-section-header h2 {
    font-size: 24px;
    color: #2d3748;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.form-section-divider {
    margin: 35px 0 25px;
    padding-top: 35px;
    border-top: 2px solid #e2e8f0;
}

.form-section-divider h3 {
    font-size: 20px;
    color: #2d3748;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.section-icon {
    font-size: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.modern-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 15px;
}

.label-icon {
    font-size: 18px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.modern-select,
.modern-input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
    background: white;
    width: 100%;
}

.modern-select:hover,
.modern-input:hover {
    border-color: #cbd5e0;
}

.modern-select:focus,
.modern-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
    color: #718096;
    font-size: 13px;
    margin-top: 6px;
}

/* Checkbox Styling */
.checkbox-group {
    margin: 25px 0;
}

.modern-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s;
}

.modern-checkbox-label:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.modern-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.checkbox-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #2d3748;
    font-size: 15px;
}

.checkmark {
    font-size: 16px;
}

/* Form Actions */
.form-actions {
    margin-top: 35px;
    text-align: center;
}

.btn-generate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-generate:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-preview {
    background: linear-gradient(135deg, #20bf55 0%, #01baef 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(32, 191, 85, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 15px;
}

.btn-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(32, 191, 85, 0.5);
}

.btn-preview:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-text {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-icon {
    font-size: 20px;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* AI Options Styling */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 0;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-container label {
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    font-size: 16px;
}

.ai-options {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
}

.ai-options .form-hint {
    color: #6c757d;
    font-size: 13px;
    margin-top: 5px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #357ABD;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-success {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background-color: #45B368;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.form-actions {
    margin-top: 20px;
    text-align: right;
}

.form-actions .btn {
    min-width: 200px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.preset-buttons {
    margin-top: 20px;
}

.preset-btn {
    padding: 8px 16px;
    font-size: 14px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Etsy Pack Section */
.etsy-pack-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.etsy-pack-section .pack-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #f0f7ff;
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
}

.etsy-pack-section .form-section-divider {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.etsy-pack-section .form-section-divider h3 {
    font-size: 16px;
    color: #374151;
    margin-bottom: 15px;
}

.etsy-pack-section .color-input {
    width: 60px;
    height: 38px;
    padding: 2px;
    cursor: pointer;
}

.etsy-pack-section .form-hint {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.etsy-pack-section textarea {
    resize: vertical;
    min-height: 100px;
}

/* Preview Actions */
.preview-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
}

/* Footer */
footer {
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-top: auto;
    padding: 25px 0;
    text-align: center;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.15);
    color: white;
}

footer p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.95;
}

/* AI Generate Button */
.ai-generate-section {
    margin-bottom: 20px;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
}

.ai-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.ai-provider-select {
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50px;
    background: rgba(255,255,255,0.2);
    color: white;
    cursor: pointer;
    min-width: 160px;
}

.ai-provider-select option {
    background: #333;
    color: white;
}

.ai-provider-select:focus {
    outline: none;
    border-color: rgba(255,255,255,0.7);
}

.btn-ai {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-ai:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.btn-ai:disabled {
    cursor: wait;
    opacity: 0.8;
}

.btn-ai .btn-icon {
    font-size: 22px;
}

.btn-ai .btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-hint {
    margin-top: 12px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.word-count {
    margin-top: 8px;
    text-align: right;
    color: #666;
    font-size: 14px;
}

#wordCountDisplay {
    font-weight: bold;
    color: var(--primary-color);
}

/* Sudoku Preset Buttons */
.preset-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    border-color: #667eea;
}

.preset-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.preset-btn.active .preset-title,
.preset-btn.active .preset-count {
    color: white;
}

.preset-icon {
    font-size: 32px;
    line-height: 1;
}

.preset-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

.preset-count {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.preset-all {
    border-color: #818cf8;
}

.preset-all:hover {
    border-color: #6366f1;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

.preset-easy {
    border-color: #86efac;
}

.preset-easy:hover {
    border-color: #4ade80;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.preset-medium {
    border-color: #fcd34d;
}

.preset-medium:hover {
    border-color: #fbbf24;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
}

.preset-hard {
    border-color: #fca5a5;
}

.preset-hard:hover {
    border-color: #f87171;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.preset-expert {
    border-color: #c4b5fd;
}

.preset-expert:hover {
    border-color: #a78bfa;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

.preset-mega {
    border-color: #fda4af;
}

.preset-mega:hover {
    border-color: #fb7185;
    background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group {
        flex-direction: column;
    }
    
    .preview-actions {
        flex-direction: column;
    }
    
    .preset-buttons-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}
