/* Base Reset and Variables */
:root {
    --bg-primary: #121212;
    --bg-secondary: rgba(255, 255, 255, 0.04);
    --bg-tertiary: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.12);
    --text-primary: #f8fafc;
    --text-secondary: #a1a1aa;
    --accent-glow: rgba(245, 158, 11, 0.4);

    --gradient-1: #f59e0b;
    /* Amber 500 */
    --gradient-2: #ea580c;
    /* Orange 600 */
    --gradient-3: #fbbf24;
    /* Amber 400 */

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic Background Effect */
.bg-gradient {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.05), transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(234, 88, 12, 0.04), transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(251, 191, 36, 0.05), transparent 55%);
    animation: drift 25s ease-in-out infinite alternate;
    z-index: -1;
    pointer-events: none;
}

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

    100% {
        transform: scale(1.03) translate(-1%, -1%);
    }
}

/* Background Orbs (Used in Login/Dashboard) */
.background-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: rgba(245, 158, 11, 0.15);
    /* Amber */
    top: -100px;
    right: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: rgba(234, 88, 12, 0.12);
    /* Orange */
    bottom: -200px;
    left: -150px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: rgba(251, 191, 36, 0.1);
    /* Gold */
    top: 40%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

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

/* Layout */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-height: 100vh;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
    align-items: start;
    flex: 1;
}

@media (max-width: 992px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism Panel / Container */
.glass-panel,
.glass-container {
    background: var(--bg-secondary);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    transition: var(--transition);
}

.glass-panel:hover,
.glass-container:hover {
    border-color: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.05), 0 30px 60px -15px rgba(0, 0, 0, 0.7);
}

/* Specific Containers */
.login-container {
    max-width: 440px;
    width: 100%;
    margin: 10vh auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.dashboard-container {
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    padding: 2.5rem;
}

/* Brand Header (Login & App Headers) */
.brand-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.brand-header h1,
.brand h2,
.logo {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
    margin: 0;
}

.brand-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

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

.admin-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gradient-1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.gradient-text {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.form-group:focus-within label {
    color: var(--gradient-1);
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--gradient-1);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

/* Fix browser autofill destroying the dark mode inputs */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1a1a1a inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Dropdown styling */
select option {
    background-color: #1a1a1a;
    color: #fff;
    padding: 10px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    width: auto;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    text-decoration: none;
    /* For link buttons */
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Dashboard Specific UI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.kpi-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition);
}

.kpi-card:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(245, 158, 11, 0.2);
    transform: translateY(-2px);
}

.kpi-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
}

.kpi-value.highlight {
    color: var(--gradient-1);
    /* Amber */
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.modern-table th,
.modern-table td {
    padding: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

.modern-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
}

.modern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-completed,
.status-translated {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    /* Emerald */
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pending {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
    /* Slate / Grey */
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.status-processing {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    /* Blue */
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-callback_failed,
.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    /* Red */
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Loaders and States */
.hidden {
    display: none !important;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 0.9rem;
}

/* Right Panel: Tabs and Content Display */
.output-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.placeholder-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    color: var(--text-secondary);
    min-height: 400px;
    gap: 1.5rem;
}

.placeholder-icon {
    color: var(--border-color);
    animation: pulse 3s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.05);
        opacity: 1;
    }
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(245, 158, 11, 0.15);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.4);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

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

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

/* Preview Styles */
.preview-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.badge {
    align-self: flex-start;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.preview-title {
    font-size: 2rem;
    color: #fff;
}

.meta-preview {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-left: 3px solid var(--gradient-1);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.meta-preview strong {
    color: #8ab4f8;
    /* Google-link-like color for meta title */
    display: block;
    margin-bottom: 0.3rem;
    font-size: 1.1rem;
}

.meta-preview p {
    color: #bdc1c6;
    font-size: 0.9rem;
}

.html-preview-box {
    background: #ffffff;
    /* White bg makes html pop clearly */
    color: #1a1a1a;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.html-preview-box h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #000;
}

.html-preview-box p {
    margin-bottom: 1rem;
}

.html-preview-box ul {
    padding-left: 2rem;
    margin-bottom: 1rem;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1.2rem;
}

.faq-q {
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.faq-q::before {
    content: "Q:";
    color: var(--gradient-2);
}

.faq-a {
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
}

.faq-a::before {
    content: "A:";
    color: var(--gradient-3);
    font-weight: 600;
}

/* JSON Code Box */
#jsonTab {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
}

.json-code {
    display: block;
    background: #0d1117;
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 0.9rem;
    color: #e6edf3;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 600px;
    overflow-y: auto;
}