/* Main Generator Wrapper */
.htaccess-generator-wrapper {
    margin-top: 2rem;
    width: 100%;
    padding: 0 15px;
}

.generator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 2rem;
    min-height: calc(100vh - 400px);
    height: auto;
    max-width: 100%;
}

/* Config Panel */
.config-panel {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Preset Section */
.preset-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.preset-btn:hover {
    background: #f3f4f6;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.preset-btn i {
    font-size: 24px;
    color: #3b82f6;
}

.preset-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.preset-btn.active i {
    color: #1e40af;
}

/* Config Tabs */
.config-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
    overflow-x: auto;
    flex-shrink: 0;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #3b82f6;
    background: #f9fafb;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.tab-btn i {
    font-size: 16px;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.config-group {
    margin-bottom: 24px;
}

.group-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
}

/* Checkbox Labels */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.checkbox-label:hover {
    background: #f9fafb;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #3b82f6;
    border-color: #3b82f6;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.label-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.label-text {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.label-desc {
    font-size: 12px;
    color: #6b7280;
}

/* Input Groups */
.input-group {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

/* Domain group - hotlink protection input */
.domain-input-wrapper,
#domain-group {
    display: none;
    width: 100%;
    min-width: 0;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    box-sizing: border-box;
}

#domain-group.visible,
.domain-input-wrapper.visible {
    display: block !important;
}

#domain-group .input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

#domain-group .form-control,
#domain-group #domain {
    width: 100%;
    min-width: 200px;
    max-width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

#domain-group .form-control:focus,
#domain-group #domain:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Ensure domain group takes full width in config panel */
.config-group #domain-group.visible {
    width: 100%;
    max-width: 100%;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Redirects */
.redirects-list {
    margin-bottom: 16px;
}

.redirect-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.redirect-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.redirect-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}

.redirect-type {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    min-width: 70px;
}

.remove-redirect {
    padding: 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.remove-redirect:hover {
    background: #dc2626;
}

.btn-add {
    width: 100%;
    padding: 12px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.btn-add:hover {
    background: #059669;
}

/* Cache Grid */
.cache-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.cache-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cache-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.cache-input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.cache-unit {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
}

/* Custom Textarea */
.custom-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    
    resize: vertical;
    min-height: 150px;
}

.custom-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Warning Box */
.warning-box {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    margin-top: auto;
    flex-shrink: 0;
}

.warning-box i {
    color: #f59e0b;
    font-size: 20px;
    flex-shrink: 0;
}

.warning-content {
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
}

.warning-content strong {
    font-weight: 600;
}

/* Output Panel */
.output-panel {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 600px;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 12px;
}

.output-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.output-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-generate {
    background: #3b82f6;
    color: white;
}

.btn-generate:hover {
    background: #2563eb;
}

.btn-copy {
    background: #10b981;
    color: white;
}

.btn-copy:hover {
    background: #059669;
}

.btn-download {
    background: #6366f1;
    color: white;
}

.btn-download:hover {
    background: #4f46e5;
}

.btn-clear {
    background: #6b7280;
    color: white;
}

.btn-clear:hover {
    background: #4b5563;
}

.action-btn i {
    font-size: 14px;
}

.output-content {
    flex: 1;
    padding: 24px;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-right: 24px;
}

.htaccess-editor {
    width: 100%;
    flex: 1;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    
    font-size: 13px;
    line-height: 1.6;
    background: #f9fafb;
    resize: none;
    color: #111827;
    min-height: 0;
}

.htaccess-editor:focus {
    outline: none;
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .generator-container {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .config-panel {
        height: auto;
    }

    .output-panel {
        height: auto;
        min-height: 500px;
    }

    .htaccess-editor {
        min-height: 400px;
    }

    .tab-content.active {
        display: block;
    }
}

@media (max-width: 768px) {
    .config-panel {
        padding: 16px;
        max-height: none;
    }

    .preset-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .preset-btn {
        padding: 12px 8px;
        font-size: 12px;
    }

    .preset-btn i {
        font-size: 20px;
    }

    .config-tabs {
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .tab-btn span {
        display: none;
    }

    .redirect-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .redirect-type {
        width: 100%;
    }

    .cache-grid {
        grid-template-columns: 1fr;
    }

    .output-header {
        flex-direction: column;
        align-items: stretch;
    }

    .output-actions {
        width: 100%;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
    }

    .action-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .output-actions {
        grid-template-columns: repeat(2, 1fr);
        display: grid;
    }
}
