@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --card-bg: rgba(17, 24, 39, 0.75);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-gradient: linear-gradient(135deg, #a855f7, #ec4899);
    --accent-glow: rgba(168, 85, 247, 0.25);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(168, 85, 247, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.12) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

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

/* Navbar */
.navbar {
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid var(--card-border);
    transition: var(--transition);
}

.back-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-2px);
}

[dir="rtl"] .back-link:hover {
    transform: translateX(2px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 0 16px var(--accent-glow);
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lang-selector {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.lang-selector:hover {
    border-color: var(--accent-purple);
}

.lang-selector option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--accent-purple);
    margin-bottom: 1.25rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-pink);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-pink);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(236, 72, 153, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); }
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #ffffff 0%, #d1d5db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 680px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.stats-ribbon {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-val {
    color: var(--text-primary);
    font-weight: 700;
}

/* Card & Forms */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.input-main-wrapper {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
    .input-main-wrapper {
        flex-direction: column;
    }
}

.input-container {
    position: relative;
    flex: 1;
}

.main-input {
    width: 100%;
    height: 56px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 0 1.25rem;
    font-size: 1.05rem;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.main-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 16px var(--accent-glow);
    background: rgba(255, 255, 255, 0.07);
}

.paste-icon-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

[dir="ltr"] .paste-icon-btn { right: 10px; }
[dir="rtl"] .paste-icon-btn { left: 10px; }

.paste-icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn {
    height: 56px;
    padding: 0 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 18px var(--accent-glow);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.9;
}

/* Accordion Options */
.options-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.75rem 0;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    user-select: none;
    border-top: 1px solid var(--card-border);
    margin-top: 0.5rem;
}

.options-toggle:hover {
    color: var(--text-primary);
}

.options-content {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    padding-top: 1.25rem;
}

.options-content.open {
    display: grid;
}

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

.field-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.sub-input, .select-input {
    width: 100%;
    height: 46px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 0 1rem;
    color: var(--text-primary);
    outline: none;
    font-size: 0.95rem;
    transition: var(--transition);
}

.sub-input:focus, .select-input:focus {
    border-color: var(--accent-purple);
    background: rgba(255, 255, 255, 0.08);
}

.select-input option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Result Section */
.result-card {
    display: none;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.4s ease-out;
}

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

.result-card.active {
    display: block;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.result-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

.result-body-grid {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 1.5rem;
}

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

.short-url-box {
    display: flex;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    align-items: center;
    margin-bottom: 1.25rem;
}

.short-url-text {
    flex: 1;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-purple);
    word-break: break-all;
}

.qr-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.qr-canvas {
    background: #fff;
    padding: 8px;
    border-radius: var(--radius-sm);
    width: 140px;
    height: 140px;
}

/* History & Table */
.history-section {
    margin-top: 1rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
}

.custom-table th, .custom-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
}

.custom-table th {
    color: var(--text-secondary);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.02);
}

.custom-table td {
    color: var(--text-primary);
}

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-expired { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-lock { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

[dir="ltr"] .modal-close { right: 1.25rem; }
[dir="rtl"] .modal-close { left: 1.25rem; }

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

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

[dir="ltr"] .toast-container { right: 2rem; }
[dir="rtl"] .toast-container { left: 2rem; }

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-purple);
    color: var(--text-primary);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    animation: slideUp 0.3s ease-out;
}

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

/* Redirect View */
.redirect-body {
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.redirect-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    max-width: 460px;
    width: 100%;
    text-align: center;
}

.redirect-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

footer {
    border-top: 1px solid var(--card-border);
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
