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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

#main-container {
    max-width: none !important;
    width: 100% !important;
    padding: 1rem 0.5rem !important;
}

#main-container > header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

#main-container > main {
    width: 100%;
    max-width: none;
}

/* Humanize Tab - Full width with adjustable container */
#humanize-tab {
    padding: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Global Controls - in header */
.global-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 1rem;
    width: 100%;
    max-width: 100%;
}

.humanize-container {
    width: 95%;
    max-width: 95%;
    margin: 1rem auto;
    transition: width 0.3s ease, max-width 0.3s ease;
}

.humanize-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.control-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.width-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.width-control input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    outline: none;
}

.width-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.width-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.width-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.width-control input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

/* Humanize Layout */
.humanize-layout {
    display: flex;
    gap: 1.5rem;
    min-height: 600px;
    align-items: stretch;
}

.humanize-layout.vertical {
    flex-direction: column;
}

.humanize-layout.horizontal {
    flex-direction: row;
}

.humanize-input-section,
.humanize-result-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    min-height: 500px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.humanize-input-section:hover,
.humanize-result-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--primary);
}

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

.section-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

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

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.result-meta strong {
    color: var(--text);
}

#humanize-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 1rem;
}

#text-input {
    flex: 1;
    width: 100%;
    padding: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    resize: none;
    line-height: 1.7;
    transition: all 0.2s ease;
}

#text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

#text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.text-output {
    flex: 1;
    padding: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    overflow-y: auto;
    min-height: 400px;
    transition: all 0.2s ease;
}

.text-output:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Remove text highlighting */
.text-output span {
    background: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
}

/* Light Theme */
body.light-theme {
    --bg: #ffffff;
    --bg-card: #f8fafc;
    --bg-hover: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --shadow: rgba(0, 0, 0, 0.1);
}

body.light-theme .text-output,
body.light-theme #text-input {
    background: #ffffff;
    border-color: #e2e8f0;
}

/* Responsive - Small screens */
@media (max-width: 768px) {
    .humanize-layout {
        flex-direction: column !important;
    }
    
    .humanize-input-section,
    .humanize-result-section {
        min-height: 300px;
    }
    
    .text-output {
        min-height: 250px;
    }
    
    .humanize-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .control-group {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .width-control {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 0.75rem;
        width: 100%;
    }
    
    .humanize-container {
        width: 100% !important;
        max-width: 100% !important;
    }
}

header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px var(--shadow);
}

.card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
    font-family: 'Courier New', monospace;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.char-count {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.result-box h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.result-section {
    margin-bottom: 1.5rem;
}

.result-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

.text-output {
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

.text-output span {
    display: inline;
    transition: opacity 0.2s;
}

.text-output span:hover {
    opacity: 0.8;
}

/* Auth Modal - Modern Design */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.auth-background {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.auth-shapes {
    position: relative;
    width: 100%;
    height: 100%;
}

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

.shape-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    bottom: -50px;
    right: -50px;
    animation-delay: 5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #ec4899, #f59e0b);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
    z-index: 10;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.auth-logo svg {
    color: var(--primary);
    width: 32px;
    height: 32px;
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
    font-weight: 400;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    background: var(--bg);
    padding: 0.25rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.auth-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

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

.auth-tab-btn.active {
    color: var(--text);
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form .form-group label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.password-requirements {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-form input::placeholder {
    color: var(--text-muted);
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 6px;
    z-index: 1;
}

.password-toggle:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.password-strength {
    margin-top: 0.75rem;
}

.strength-bar {
    height: 3px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.strength-fill.weak {
    width: 33%;
    background: var(--danger);
}

.strength-fill.medium {
    width: 66%;
    background: var(--warning);
}

.strength-fill.strong {
    width: 100%;
    background: var(--success);
}

.strength-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-auth {
    width: 100%;
    padding: 0.875rem 1.5rem;
    margin-top: 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.btn-auth .btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    animation: spin 1s linear infinite;
}

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

.error-message {
    color: var(--danger);
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.4s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.result-meta {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

.status-box {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.status-box h3 {
    margin-bottom: 1rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.status-item:last-child {
    border-bottom: none;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-badge.valid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.invalid {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: var(--bg-hover);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

tbody tr:hover {
    background: var(--bg-hover);
}

.status-cell {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-block;
}

.status-cell.pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-cell.processing {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.status-cell.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-cell.failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

.help-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.help-box h4 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.help-box ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.help-box li {
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.help-box code {
    background: var(--bg-card);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--primary);
}

.help-box a {
    color: var(--primary);
    text-decoration: none;
}

.help-box a:hover {
    text-decoration: underline;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-info {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--primary);
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-container {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.5rem;
    }
}

