@font-face {
    font-family: 'RTA';
    src: url('fonts/RTA.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Modern Scrollbar UI Improvement */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: rgba(31, 117, 254, 0.3);
    border-radius: 10px;
    border: 2px solid #0f172a;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(31, 117, 254, 0.6);
}

:root {
    --primary-gradient: linear-gradient(135deg, #1f75fe 0%, #0e59d1 100%);
    --secondary-gradient: linear-gradient(135deg, #1f75fe 0%, #2dd4bf 100%);
    --bg-dark: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #1f75fe;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background Mesh Gradients */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 10% 20%, rgba(31, 117, 254, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(14, 89, 209, 0.15) 0%, transparent 40%);
}

header {
    padding: 0;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1300px;
    margin: 0 auto;
}

.header-right .logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.header-right .logo-link:hover {
    transform: scale(1.05);
}

.logo-icon {
    width: 48px;
    height: 48px;
    filter: none;
    box-shadow: none;
}

.site-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-color);
    letter-spacing: -0.5px;
}

.header-center {
    display: flex;
    gap: 2rem;
}

.header-center a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.header-center a:hover {
    color: var(--text-primary);
}

.header-left .start-now-btn {
    background: var(--primary-gradient);
    color: white;
    padding: 0.75rem 1.75rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(31, 117, 254, 0.2);
}

.header-left .start-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(31, 117, 254, 0.4);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    /* Slightly reduced gap to accommodate longer copyright */
}

.copyright a {
    transition: opacity 0.2s;
}

.copyright a:hover {
    opacity: 0.8;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1.5rem;
    text-align: center;
}

h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

p.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.shortener-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 24px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s ease-out;
}

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

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

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

input[type="url"],
input[type="text"] {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(31, 117, 254, 0.2);
}

button#shorten-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button#shorten-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(31, 117, 254, 0.5);
}

button#shorten-btn:active {
    transform: translateY(0);
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

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

.customize-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 1rem;
    justify-content: flex-start;
    font-size: 0.9rem;
}

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

.custom-alias-group {
    display: none;
    animation: fadeIn 0.3s ease;
    margin-bottom: 1.5rem;
}

.custom-alias-group.active {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.alias-prefix {
    color: var(--text-secondary);
    font-weight: 500;
}

.result-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
    display: none;
}

.result-container.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.shortened-url-box {
    background: rgba(31, 117, 254, 0.1);
    border: 1px dashed var(--accent-color);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.shortened-url-text {
    font-weight: 600;
    color: var(--accent-color);
    direction: ltr;
    /* Short URLs usually look better LTR */
}

.copy-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: var(--glass-border);
}

footer {
    padding: 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 5rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.footer-content {
    width: 90%;
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.copyright a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

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

@media (max-width: 1024px) {
    .header-center {
        display: none;
        /* Hide center menu on small tablets & mobile */
    }
}

@media (max-width: 768px) {
    .header-content {
        justify-content: space-between;
    }

    .header-left {
        display: none;
        /* Hide start button on mobile to save space */
    }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
        gap: 1.5rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    button#shorten-btn {
        padding: 1.25rem;
    }
}

/* SPA Additions */
#main-content {
    transition: opacity 0.3s ease;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#main-content.fade-out {
    opacity: 0;
}

.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.page-content {
    animation: slideUp 0.6s ease-out;
    width: 100%;
}

/* Modern Notification System (Toast) */
.toast-container {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.75rem;
    border-radius: 14px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastIn 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    pointer-events: auto;
}

.toast.error {
    border-right: 4px solid #ef4444;
}

.toast.success {
    border-right: 4px solid #10b981;
}

.toast.fade-out {
    animation: toastOut 0.4s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
}

/* Mobile Menu Styles */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 5px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1.5rem;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
}

.mobile-menu-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.mobile-menu-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.mobile-menu-links a:hover {
    color: var(--text-primary);
    background: rgba(31, 117, 254, 0.1);
}

.mobile-menu-links a::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    margin-left: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-links a:hover::before {
    opacity: 1;
}

.mobile-menu-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

.start-now-btn.mobile {
    display: block;
    text-align: center;
    width: 100%;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .header-center {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .header-content {
        justify-content: space-between;
    }

    .header-left {
        display: none;
    }

    .footer-content {
        flex-direction: row;
        gap: 1rem;
        text-align: center;
        flex-wrap: wrap;
        justify-content: center;
    }

    .footer-links {
        justify-content: center;
        gap: 1.5rem;
        flex-wrap: wrap;
    }

    h1 {
        font-size: 2.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    button#shorten-btn {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .mobile-menu {
        width: 90%;
    }
}