* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066ff;
    --primary-dark: #0052cc;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #252b3b;
    --text-primary: #ffffff;
    --text-secondary: #b8c5d1;
    --border-color: #2d3748;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    margin: 0;
    padding: 0;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    will-change: transform;
}

/* Sidebar is always visible - no collapse functionality */

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 56px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.brand-logo {
    width: 32px;
    height: 32px;
    background: #28a745;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.brand-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.brand-dot {
    color: #0066ff;
    font-size: 6px;
    flex-shrink: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 14px;
    border-left: 3px solid transparent;
    cursor: pointer;
    user-select: none;
}

.nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 21px;
    margin-bottom: 21px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.header-content {
    text-align: center;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo .icon {
    font-size: 1.75rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.77rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 1024px) {
    .panel-grid {
        grid-template-columns: 1fr;
    }
}

/* Configuration Grid for LP Generator */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }
}

/* Panel */
.panel {
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.panel-header {
    background: var(--bg-tertiary);
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 0.91rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 7px;
}

.panel-body {
    padding: 14px;
}

.panel-output {
    margin-top: 14px;
}

/* Form Elements */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.form-input.error,
.form-textarea.error {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.error-message {
    display: block;
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 4px;
}

.char-count {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
    text-align: right;
}

.char-count.warning {
    color: var(--warning-color);
}

.char-count.error {
    color: var(--danger-color);
}

/* Drag and Drop */
.drag-over {
    border: 2px dashed var(--primary-color) !important;
    background: rgba(0, 102, 255, 0.05) !important;
}

.form-textarea {
    resize: vertical;
    min-height: 56px;
}

/* Code Editor */
.code-editor {
    width: 100%;
    min-height: 280px;
    padding: 10px;
    background: #1e1e1e;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #d4d4d4;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    resize: vertical;
    overflow-y: auto;
}

.code-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Links Container */
.links-container {
    margin-bottom: 7px;
}

.link-pair {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
}

.link-pair .form-input {
    flex: 1;
}

.arrow {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.btn-remove {
    background: var(--danger-color);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove:hover {
    background: #c82333;
}

.btn-add-link {
    width: 100%;
    padding: 7px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s, border-color 0.2s;
}

.btn-add-link:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

/* File Upload */
.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-input-hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.btn-upload {
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
}

.btn-upload:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

.file-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

/* Buttons */
.btn-generate {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 14px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.btn-generate:active {
    transform: translateY(0);
}

.btn-icon {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-size: 0.77rem;
}

.btn-icon:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    width: 90%;
    max-width: 1000px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 0.91rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-close:hover {
    background: var(--bg-tertiary);
}

.modal-body {
    flex: 1;
    padding: 14px;
    overflow: hidden;
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Page Sections */
.page-section {
    display: block;
}

/* Multi Domain Generator */
.panel-grid-multi {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

@media (max-width: 1024px) {
    .panel-grid-multi {
        grid-template-columns: 1fr;
    }
}

/* Check Brand */
.panel-grid-brand {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

@media (max-width: 1024px) {
    .panel-grid-brand {
        grid-template-columns: 1fr;
    }
}

.keywords-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 350px;
    overflow-y: auto;
    padding: 3px 0;
}

.keyword-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.2s;
}

.keyword-item:hover {
    border-color: var(--primary-color);
}

.keyword-text {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.8rem;
}

.keyword-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.btn-check-keyword {
    padding: 4px 8px;
    background: var(--primary-color);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
}

.btn-check-keyword:hover {
    background: var(--primary-dark);
}

.btn-check-keyword.mobile {
    background: var(--success-color);
}

.btn-check-keyword.mobile:hover {
    background: #218838;
}

.btn-remove-keyword {
    background: var(--danger-color);
    color: white;
    border: none;
    width: 19px;
    height: 19px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.77rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove-keyword:hover {
    background: #c82333;
}

.empty-state {
    display: block;
}

.empty-state.hidden {
    display: none;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.dashboard-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 21px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 2.45rem;
    margin-bottom: 7px;
}

.dashboard-card h3 {
    font-size: 0.91rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.dashboard-card p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.6;
    margin: 0;
    flex: 1;
}

.card-button {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    margin-top: 7px;
}

.card-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.card-button:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-card {
        padding: 20px;
    }
    
    .card-icon {
        font-size: 2.5rem;
    }
}

/* Path Items */
.paths-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 7px 0;
}

@media (max-width: 1200px) {
    .paths-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .paths-container {
        grid-template-columns: 1fr;
    }
}

.path-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    transition: border-color 0.2s;
    min-width: 0; /* Prevent grid overflow */
}

.path-item:hover {
    border-color: var(--primary-color);
}

.path-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border-color);
}

.path-item-header h3 {
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-remove-path {
    background: var(--danger-color);
    color: white;
    border: none;
    width: 21px;
    height: 21px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-remove-path:hover {
    background: #c82333;
}

.path-item-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.path-item-body .form-group {
    margin-bottom: 0;
}

.path-item-body .form-group small {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
}

.path-links-container,
.path-words-container {
    margin-bottom: 7px;
}

.word-pair {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
}

.word-pair .form-input {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .container {
        padding: 10px;
    }

    .logo {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .panel-header {
        padding: 15px;
    }

    .panel-body {
        padding: 15px;
    }

    .code-editor {
        min-height: 300px;
        font-size: 0.8rem;
    }
}

