/* Tech-Indigo Glassmorphism Theme */
:root {
    --bg-color: #0f172a;
    /* Slate 900 */
    --card-bg: rgba(30, 41, 59, 0.7);
    /* Slate 800 with opacity */
    --pane-bg: rgba(15, 23, 42, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.4);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    --accent: #8b5cf6;
    /* Violet 500 */
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 1rem;
    display: flex;
    justify-content: center;
}

/* Back Link */
.back-home-link {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
    z-index: 100;
}

.back-home-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Background Blobs */
.blob-bg {
    position: fixed;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.4;
    animation: drift 15s ease-in-out infinite alternate;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary), transparent 70%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    animation-delay: -5s;
}

.blob-3 {
    top: 20%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.3), transparent 70%);
}

@keyframes drift {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, -30px);
    }
}

/* Layout */
.layout-wrapper {
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    margin-top: 4rem;
    padding: 0 1rem;
    gap: 1.5rem;
}

/* Header */
.app-header {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.app-header .logo {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.highlight {
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Split Pane Layout */
.split-pane {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    height: calc(100vh - 250px);
    min-height: 600px;
}

@media (max-width: 900px) {
    .split-pane {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.pane {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.pane-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.pane-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.char-count,
.chunk-count {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.char-count span,
.chunk-count span {
    color: var(--primary);
    font-weight: 700;
}

/* Pane Left: Input */
.platform-selector {
    padding: 1rem 1.5rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.platform-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.platform-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

#custom-limit-wrapper {
    padding: 0.5rem 1.5rem 0;
}

#custom-limit {
    width: 100%;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    outline: none;
}

#custom-limit:focus {
    border-color: var(--primary);
}

.options-row {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin-right: 0.75rem;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: #f43f5e;
}

/* Textarea */
#source-text {
    flex-grow: 1;
    width: 100%;
    background: var(--pane-bg);
    border: none;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

#source-text::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

#source-text:focus {
    border-top-color: var(--primary);
}

/* Pane Right: Output */
.action-bar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.primary-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.primary-btn:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
    cursor: not-allowed;
}

.output-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.output-container::-webkit-scrollbar {
    width: 6px;
}

.output-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: rgba(255, 255, 255, 0.2);
    text-align: center;
    gap: 1rem;
}

.empty-state i {
    font-size: 3rem;
}

/* Chunk Card */
.chunk-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    animation: fadeIn 0.3s ease;
    transition: border-color 0.3s;
}

.chunk-card:hover {
    border-color: var(--border-highlight);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.chunk-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.chunk-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chunk-meta.warning {
    color: #fbbf24;
}

.chunk-content {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.copy-chunk-btn {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.copy-chunk-btn:hover {
    background: var(--primary);
}

.copy-chunk-btn i {
    font-size: 0.9rem;
}

/* SEO Footer */
.seo-footer {
    text-align: center;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 500;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.hidden {
    display: none !important;
}