/* ============================================
   RAXXSLINK - Design System
   ============================================ */
:root {
    --primary: #9d50bb;
    --secondary: #6e48aa;
    --accent: #ff00cc;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-white: #f8fafc;
    --text-dim: #94a3b8;
    --success: #10b981;
    --error-color: #ff477e;
    --glow: 0 0 20px rgba(157, 80, 187, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing Scale */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.75rem;
    --radius-md: 1.25rem;
    --radius-lg: 2rem;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport for mobile browsers */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    /* Safe area padding for notch devices */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================
   BACKGROUND BLOBS
   ============================================ */
.blob-bg, .blob-bg-2 {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.blob-bg {
    width: clamp(300px, 60vw, 600px);
    height: clamp(300px, 60vw, 600px);
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.blob-bg-2 {
    width: clamp(250px, 50vw, 550px);
    height: clamp(250px, 50vw, 550px);
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
}

/* ============================================
   LAYOUT CONTAINER
   ============================================ */
.container {
    width: 100%;
    max-width: 820px;
    padding: var(--space-lg) var(--space-sm);
    text-align: center;
    z-index: 10;
    position: relative;
}

/* ============================================
   HERO / HEADER
   ============================================ */
.hero {
    margin-bottom: clamp(2rem, 5vw, 4rem);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.logo i {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    filter: drop-shadow(var(--glow));
}

h1 {
    font-size: clamp(2rem, 7vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

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

.hero p {
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    color: var(--text-dim);
    max-width: 580px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ============================================
   SHORTENER CARD
   ============================================ */
.shortener-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: clamp(1.25rem, 4vw, 2.5rem);
    border-radius: var(--radius-lg);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    margin-bottom: var(--space-xl);
}

/* ============================================
   INPUT WRAPPER
   ============================================ */
.input-wrapper {
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 0.625rem;
    background: rgba(15, 23, 42, 0.6);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    align-items: center;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.input-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}

input[type="url"] {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-white);
    padding: 0.875rem 0.75rem 0.875rem 3rem;
    font-size: clamp(0.9rem, 2.5vw, 1.05rem);
    font-family: inherit;
    width: 100%;
    min-width: 0; /* prevent overflow in flex */
    -webkit-appearance: none;
}

input[type="url"]::placeholder {
    color: var(--text-dim);
    opacity: 0.7;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    /* Minimum touch target 44px */
    min-height: 44px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--glow);
    background: linear-gradient(135deg, #b060d8, var(--primary));
}

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

.btn-primary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: var(--text-dim);
}

.btn-copy {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 1rem;
}

.btn-copy:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--success);
    transform: scale(1.05);
}

.btn-copy:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================
   RESULT AREA
   ============================================ */
.result-area {
    margin-top: var(--space-md);
    animation: fadeInUp 0.4s ease forwards;
}

.result-label {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--success);
    margin-bottom: 0.5rem;
    margin-left: 0.25rem;
    opacity: 0.85;
}

.result-box {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
    border: 1px dashed rgba(16, 185, 129, 0.35);
    padding: clamp(0.875rem, 3vw, 1.25rem);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.result-box:hover {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.5);
}

#shortUrlText {
    font-weight: 700;
    font-size: clamp(0.875rem, 2.5vw, 1.1rem);
    word-break: break-all;
    text-align: left;
    flex: 1;
    min-width: 0;
    color: var(--success);
}

/* ============================================
   ERROR AREA
   ============================================ */
.error-area {
    margin-top: var(--space-md);
    padding: clamp(0.75rem, 2vw, 1rem);
    background: rgba(255, 71, 126, 0.08);
    border: 1px solid rgba(255, 71, 126, 0.25);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--error-color);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    text-align: left;
    animation: fadeInUp 0.3s ease forwards;
}

.error-area.hidden,
.hidden {
    display: none !important;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    opacity: 0.45;
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* --- XS: Very small phones (320px - 374px) --- */
@media (max-width: 374px) {
    .container {
        padding: 1.25rem 0.875rem;
    }

    .shortener-card {
        padding: 1rem;
        border-radius: 1.25rem;
    }

    .input-wrapper {
        flex-direction: column;
        padding: 0.875rem;
        gap: 0.625rem;
    }

    .input-icon {
        top: 1.1rem;
        transform: none;
    }

    input[type="url"] {
        padding: 0.625rem 0.625rem 0.625rem 2.5rem;
    }

    .btn-primary {
        width: 100%;
        padding: 0.875rem;
    }

    h1 { font-size: 1.8rem; }
}

/* --- SM: Standard phones (375px - 639px) --- */
@media (max-width: 639px) {
    .input-wrapper {
        flex-direction: column;
        padding: 0.875rem;
        gap: 0.5rem;
    }

    .input-icon {
        top: 1.15rem;
        left: 1.1rem;
        transform: none;
    }

    input[type="url"] {
        padding: 0.75rem 0.75rem 0.75rem 2.75rem;
    }

    .btn-primary {
        width: 100%;
        padding: 1rem;
        border-radius: var(--radius-sm);
    }

    .result-box {
        flex-wrap: wrap;
    }

    #shortUrlText {
        font-size: 0.875rem;
        width: 100%;
    }
}

/* --- MD: Tablets (640px - 767px) --- */
@media (min-width: 640px) and (max-width: 767px) {
    .container {
        padding: var(--space-lg) var(--space-md);
    }

    .input-wrapper {
        gap: 0.5rem;
    }

    .btn-primary {
        padding: 0.875rem 1.25rem;
    }
}

/* --- LG: Large tablets / small desktops (768px+) --- */
@media (min-width: 768px) {
    .container {
        padding: var(--space-xl) var(--space-lg);
    }

    .shortener-card {
        padding: 2.5rem;
    }

    .input-wrapper {
        padding: 0.5rem;
    }
}

/* --- XL: Large screens (1280px+) --- */
@media (min-width: 1280px) {
    .container {
        max-width: 860px;
    }
}

/* --- Landscape phones --- */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 1rem;
    }

    .hero {
        margin-bottom: 1.5rem;
    }

    h1 {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }

    .hero p {
        display: none;
    }
}

/* --- High DPI / Retina displays --- */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .blob-bg, .blob-bg-2 {
        filter: blur(60px);
    }
}

/* --- Reduced motion accessibility --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
