/* Base styles */
:root {
    --primary-color: #3b7d68;
    --primary-hover: #2d6151;
    --background-color: #e8f0ed;
    --card-background: #f8fbfa;
    --text-color: #1a2f2a;
    --border-color: #b8d4ca;
    --success-color: #2d9f59;
    --header-color: #1e4a3a;
    --accent-color: #4a9d7f;
    --section-bg-1: #f0f7f4;
    --section-bg-2: #e6f2ed;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #d4e8df 0%, #e0ede6 25%, #dceae3 50%, #e8f2ec 75%, #d8ebe1 100%);
    background-size: 400% 400%;
    animation: gradientWave 20s ease infinite;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes gradientWave {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.container {
    max-width: 1200px;
    margin: 0.25rem auto;
    padding: 0 15px;
}

header {
    background: linear-gradient(135deg, #1e4a3a 0%, #2d6b54 100%);
    color: #fff;
    padding: 0.4rem 1.2rem;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    flex: 1;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.subtitle {
    margin-top: 0.1rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0;
    background-color: var(--header-color);
    padding: 0 1.2rem;
    border-bottom: 2px solid var(--accent-color);
    margin-bottom: 0;
    border-radius: 0 0 8px 8px;
}

.tab-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border-bottom: 3px solid transparent;
    position: relative;
}

.tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    color: #fff;
    border-bottom-color: var(--accent-color);
    background-color: rgba(255, 255, 255, 0.1);
}

.tab-icon {
    font-size: 1rem;
}

.tab-label {
    font-size: 0.85rem;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Card layout */
.card {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 0;
    margin-top: 0.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
    border: 1px solid rgba(75, 140, 115, 0.15);
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Tab-specific styles */
.tab-description {
    color: var(--text-color);
    opacity: 0.7;
    margin: 0.3rem 0 1rem 0;
    font-size: 0.9rem;
}

.instructions {
    background: var(--section-bg-1);
    border-left: 4px solid var(--accent-color);
    padding: 0.8rem 1.2rem;
    margin-top: 1.2rem;
    border-radius: 4px;
}

.instructions h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.instructions ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.instructions li {
    margin: 0.5rem 0;
}

.info-message {
    background: #e3f2fd;
    color: #1976d2;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    border: 1px solid #bbdefb;
}

.export-actions {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.export-actions .btn {
    flex: 1;
}

.btn-large {
    padding: 1.2rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--success-color);
}

.btn-primary:hover {
    background-color: #357a38;
}

.export-info {
    background: #f8faf9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.export-info h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.export-info ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.export-info li {
    margin: 0.8rem 0;
}

/* Format selector styles */
.format-section {
    margin-bottom: 2rem;
    padding: 1.2rem;
    border-radius: 8px;
    background: var(--section-bg-1);
    border: 1px solid rgba(75, 140, 115, 0.12);
}

.format-section:nth-child(even) {
    background: var(--section-bg-2);
}

.format-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .format-selector {
        grid-template-columns: 1fr;
    }
}

.format-option {
    cursor: pointer;
    display: block;
}

.format-option input[type="radio"] {
    display: none;
}

.format-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: var(--card-background);
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.format-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.format-option input[type="radio"]:checked + .format-card {
    border-color: var(--primary-color);
    background: #f0f5f3;
    box-shadow: 0 0 0 2px rgba(44, 97, 79, 0.1);
}

.format-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.format-description {
    font-size: 0.875rem;
    color: #666;
    line-height: 1.4;
}

.help-content {
    line-height: 1.7;
}

.help-content h3 {
    color: var(--primary-color);
    margin-top: 1.8rem;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.help-content h3:first-child {
    margin-top: 0.5rem;
}

.help-content p {
    margin: 0.8rem 0;
    line-height: 1.6;
}

.help-content ul, .help-content ol {
    padding-left: 1.5rem;
    margin: 0.8rem 0;
}

.help-content li {
    margin: 0.6rem 0;
}

.help-content strong {
    color: var(--primary-color);
}

.help-content em {
    color: var(--text-color);
    font-style: italic;
}

.help-content code {
    background: var(--section-bg-1);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.help-content h4 {
    color: var(--primary-color);
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.help-content pre {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    margin: 0.8rem 0;
}

.token-indicator {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Filter stats */
.filter-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.8rem;
}

.filter-stat-item {
    background: #f8faf9;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.filter-stat-label {
    color: var(--text-color);
    opacity: 0.7;
    font-size: 0.8rem;
    font-weight: 600;
}

.filter-stat-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-left: 0.3rem;
}

/* Token count color-coding */
#token-count.token-green { color: #43a047; }
#token-count.token-yellow { color: #f9a825; }
#token-count.token-orange { color: #fb8c00; }
#token-count.token-red { color: #e53935; }

/* Output section header with buttons */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header .button-group {
    display: flex;
    gap: 0.5rem;
}

.section-header .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Output text area */
.output-area {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    box-sizing: border-box;
    line-height: 1.5;
    background: #fafafa;
}

/* Button styles */
.btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
    transform: none;
}

/* Status message */
.status-message {
    margin: 0.8rem 0;
    padding: 0.8rem;
    border-radius: 5px;
    display: none;
}

.status-message.success {
    background-color: #e8f5e9;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

.status-message.processing {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

/* Modal improvements */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 1.5rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.close {
    color: var(--text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--primary-color);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 0;
    padding: 0.8rem;
    background: linear-gradient(135deg, #1e4a3a 0%, #2d6b54 100%);
    color: #fff;
    border-radius: 0 0 8px 8px;
    font-size: 0.85rem;
}

footer p {
    margin: 0;
}

footer a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    transition: border-bottom-color 0.3s ease;
}

footer a:hover {
    border-bottom-color: #fff;
}

/* General heading styles */
h2 {
    margin: 0;
    font-size: 1.3rem;
}

/* Exclusion section styles */
.exclusion-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    user-select: none;
}

.exclusion-header:hover {
    color: var(--primary-color);
}

.collapse-indicator {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.collapse-indicator.collapsed {
    transform: rotate(-90deg);
}

.exclusion-content {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.8rem;
    background: #fafafa;
}

.exclusion-content.hidden {
    display: none;
}

.folder-tree {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.tree-item {
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-item input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.tree-item label {
    cursor: pointer;
    flex: 1;
}

.tree-folder {
    font-weight: 600;
    color: var(--primary-color);
}

.tree-file {
    color: var(--text-color);
    opacity: 0.8;
}

/* Priority button styles */
.priority-btn {
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    color: #999;
    min-width: 32px;
}

.priority-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.priority-btn.active {
    border-color: #ffa726;
    background: #fff3e0;
    font-weight: 600;
}

.priority-btn.priority-1 {
    color: #ff9800;
}

.priority-btn.priority-2 {
    color: #ff9800;
}

.priority-btn.priority-3 {
    color: #f57c00;
}

.priority-btn.priority-4 {
    color: #ef6c00;
}

.priority-btn.priority-5 {
    color: #e65100;
    background: #ffe0b2;
    border-color: #ff9800;
}

.tree-indent {
    display: inline-block;
    width: 20px;
}

.excluded-label {
    text-decoration: line-through;
    opacity: 0.5;
}

/* Filter section styles */
.filter-section {
    margin-bottom: 1.2rem;
    padding: 1.2rem;
    border-radius: 8px;
    background: var(--section-bg-1);
    border: 1px solid rgba(75, 140, 115, 0.12);
}

.filter-section:nth-child(even) {
    background: var(--section-bg-2);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-section h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.helper-text {
    font-size: 0.9rem;
    color: #666;
    margin: 0.5rem 0;
}

/* Preset buttons */
.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
}

.btn-preset {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    background-color: #fff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    white-space: nowrap;
}

.btn-preset:hover {
    background-color: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
}

.btn-preset.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* Pattern input */
.pattern-input {
    width: 100%;
    min-height: 100px;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
    margin-bottom: 0.8rem;
}

.pattern-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.pattern-status {
    margin-top: 0.5rem;
    padding: 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    display: none;
}

.pattern-status.visible {
    display: block;
}

.pattern-status.success {
    background-color: #e8f5e9;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

.pattern-status.info {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        margin: 0.3rem auto;
        padding: 10px;
    }

    header {
        padding: 0.6rem 1rem;
    }

    .header-content {
        width: 100%;
    }

    h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .tab-navigation {
        padding: 0;
        overflow-x: auto;
    }

    .tab-btn {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
        flex-shrink: 0;
    }

    .tab-icon {
        font-size: 1rem;
    }

    .tab-label {
        font-size: 0.85rem;
    }

    .export-actions {
        flex-direction: column;
    }

    .export-actions .btn {
        width: 100%;
    }

    .btn {
        width: 100%;
        margin: 0.4rem 0;
    }

    .output-area {
        min-height: 300px;
        font-size: 0.8rem;
    }

    .folder-tree {
        font-size: 0.8rem;
        max-height: 400px;
    }

    .preset-buttons {
        flex-direction: column;
    }

    .btn-preset {
        width: 100%;
    }

    .format-selector {
        grid-template-columns: 1fr;
    }

    .format-card {
        padding: 0.8rem;
    }

    .format-name {
        font-size: 0.95rem;
    }

    .format-description {
        font-size: 0.8rem;
    }
}

/* Recent Projects Styles */
.recent-projects {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.recent-projects h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.recent-projects-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.recent-project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.recent-project-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.recent-project-info {
    flex: 1;
}

.recent-project-name {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.recent-project-meta {
    font-size: 0.85rem;
    color: #666;
}

/* Preset Management Styles */
.preset-management-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.preset-name-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
}

.preset-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Keyboard shortcuts removed per user request */

/* Large project optimization notice */
.info-message {
    padding: 1rem;
    background-color: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #1976d2;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 1px dotted var(--text-color);
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 220px;
    background-color: var(--header-color);
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 0.6rem;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--header-color) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}
