* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.logo {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo h1 {
    font-size: 18px;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.nav-icon {
    margin-right: 12px;
    font-size: 16px;
}

.upgrade-button {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.upgrade-button button {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #FFA726 0%, #FF9800 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.upgrade-button button:hover {
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.search-container {
    position: relative;
    width: 350px;
}

.search-container input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.search-container input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

/* Content Area */
.content-area {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Panel */
.left-panel {
    width: 300px;
    background: #f9fafb;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
}

.category-section {
    margin-bottom: 30px;
}

.category-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 15px;
}

.tool-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-card {
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-card:hover {
    border-color: #8B5CF6;
    background: #faf5ff;
}

.tool-card.selected {
    border-color: #8B5CF6;
    background: #8B5CF6;
    color: white;
}

/* Right Panel */
.right-panel {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.tool-content {
    display: block;
}

.tool-content.hidden {
    display: none;
}

.tool-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.tool-desc {
    color: #6b7280;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
    font-size: 14px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.input-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* Text Input (specific for text formatter) */
.text-input {
    width: 100%;
    height: 200px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    margin-bottom: 20px;
    outline: none;
}

.text-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Buttons */
.generate-btn {
    padding: 12px 24px;
    background: #8B5CF6;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 20px;
}

.generate-btn:hover {
    background: #7C3AED;
}

.format-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.format-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.format-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn {
    background: #8B5CF6;
    border: none;
    color: white;
}

.download-btn:hover {
    background: #7C3AED;
}

.clear-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
}

.clear-btn:hover {
    background: #e5e7eb;
}

/* Output Areas */
.output-area {
    margin-top: 20px;
}

.output-area h4 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;
}

.output-box {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

.preview-section {
    margin-top: 20px;
}

.preview-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;
}

.preview-box {
    width: 100%;
    min-height: 100px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Word Count */
.word-count {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 20px;
}

.character-count {
    font-size: 12px;
    color: #6b7280;
    margin-top: 10px;
}

/* Optimization Options */
.optimization-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.optimization-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}

.optimization-options input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Scrollbar */
.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
    width: 6px;
}

.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

.left-panel::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar .logo,
    .sidebar .nav-item span:last-child,
    .sidebar .upgrade-button {
        display: none;
    }
    
    .left-panel {
        width: 250px;
    }
    
    .search-container {
        width: 250px;
    }
}
/* Add to your existing style.css */

/* Ensure content-area takes full height and uses flexbox */
.content-area {
    display: flex;
    flex: 1; /* Allows it to grow and shrink */
    height: calc(100vh - 65px); /* Adjust 65px based on your header height */
    overflow: hidden; /* Prevents main content area from scrolling itself */
}

/* Styles for main-page divs when they are active */
.main-page {
    flex: 1;
    padding: 30px;
    overflow-y: auto; /* Allows scrolling within the main page content */
    display: none; /* Hidden by default */
}

.main-page:not(.hidden) {
    display: block; /* Show when not hidden */
}

/* Specific handling for AI Writer page to show left and right panels */
#ai-writer.main-page:not(.hidden) {
    display: flex; /* Use flex to contain left and right panels */
    padding: 0; /* Remove padding as left/right panels have their own */
}

/* Right panel specific styles */
.right-panel {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: block; /* Default to block, script will hide/show */
}

.right-panel.hidden {
    display: none;
}

/* Left panel specific styles */
.left-panel {
    width: 300px;
    background: #f9fafb;
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
    display: block; /* Default to block, script will hide/show */
}

.left-panel.hidden {
    display: none;
}