/* Override global styles */
.container {
    max-width: 1400px !important;
    margin: 0 auto;
    padding: 2rem;
    text-align: left !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    text-align: left;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: opacity 0.2s;
}

.back-link:hover {
    opacity: 0.8;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    padding: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: fit-content;
}

.mode-tab {
    padding: 0.7rem 1.4rem;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-tab:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.04);
}

.mode-tab.active {
    background: rgba(77, 171, 247, 0.15);
    color: var(--link-color);
    font-weight: 600;
}

.mode-content {
    display: none;
}

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

/* Status Bar */
.status-bar {
    display: flex;
    gap: 2rem;
    align-items: center;
    padding: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--nav-submenu-bg);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-item i {
    color: var(--link-color);
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-separator {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    background: rgba(77, 171, 247, 0.1);
    border-color: rgba(77, 171, 247, 0.3);
    color: var(--link-color);
}

.btn:active {
    transform: scale(0.97);
}

.btn-caution {
    border-color: rgba(243, 156, 18, 0.25);
}

.btn-caution:hover {
    background: rgba(243, 156, 18, 0.1);
    border-color: rgba(243, 156, 18, 0.4);
    color: #f39c12;
}

.toolbar-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
}

.caution-label {
    color: rgba(243, 156, 18, 0.6);
    position: relative;
    cursor: help;
}

.caution-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #1e1e1e;
    border: 1px solid rgba(243, 156, 18, 0.4);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

.caution-label:hover .caution-tooltip {
    display: block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--link-color) 0%, #339af0 100%);
    color: #121212;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #339af0 0%, #228be6 100%);
    color: #121212;
    box-shadow: 0 4px 15px rgba(77, 171, 247, 0.4);
}

/* Find & Replace */
.find-replace-bar {
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fr-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.fr-row label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    min-width: 55px;
}

.fr-row input[type="text"] {
    flex: 1;
    min-width: 150px;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-color);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.fr-row input[type="text"]:focus {
    outline: none;
    border-color: var(--link-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--link-color);
}

.match-count {
    font-size: 0.85rem;
    color: var(--link-color);
    font-weight: 500;
}

/* Wrap Options */
.wrap-options {
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--link-color);
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Editor */
.editor-wrapper {
    min-height: 400px;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    height: 400px;
}

.editor-container {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.highlight-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.25rem;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
    color: transparent;
    pointer-events: none;
    tab-size: 2;
    text-align: left;
}

.highlight-backdrop mark {
    background: rgba(243, 156, 18, 0.35);
    color: transparent;
    border-radius: 2px;
}

.highlight-backdrop mark.current {
    background: rgba(77, 171, 247, 0.6);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.panel-btn {
    padding: 0.35rem 0.7rem;
    border-radius: 5px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-btn:hover {
    background: rgba(77, 171, 247, 0.15);
    color: var(--link-color);
}

.btn-danger-sm {
    border-color: rgba(231, 76, 60, 0.2);
}

.btn-danger-sm:hover {
    background: rgba(231, 76, 60, 0.1) !important;
    color: #e74c3c !important;
}

.editor-textarea {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    padding: 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    tab-size: 2;
    text-align: left;
    z-index: 1;
}

.editor-textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Generate Panel */
.generate-panel {
    background: var(--nav-submenu-bg);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gen-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.gen-row label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    min-width: 55px;
}

.tool-select,
.gen-row input[type="number"] {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #1e1e1e;
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.tool-select option {
    background: #1e1e1e;
    color: var(--text-color);
}

.tool-select:focus,
.gen-row input[type="number"]:focus {
    outline: none;
    border-color: var(--link-color);
}

.gen-row input[type="number"] {
    width: 100px;
    cursor: text;
}

.gen-charsets {
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.gen-charset-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-right: 0.5rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.85rem 1.5rem;
    background: var(--nav-submenu-bg);
    border: 1px solid rgba(77, 171, 247, 0.3);
    border-radius: 10px;
    color: var(--link-color);
    font-size: 0.9rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Mobile */
@media (max-width: 900px) {
    .container {
        padding: 1rem;
    }
    .mode-tabs {
        flex-wrap: wrap;
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .toolbar-group {
        gap: 0.35rem;
    }
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
}
