/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: #0a0a0a;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

#app {
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Container */
.relative {
    position: relative;
}

.w-full {
    width: 100%;
}

.h-screen {
    height: 100vh;
}

.overflow-hidden {
    overflow: hidden;
}

.select-none {
    user-select: none;
}

.absolute {
    position: absolute;
}

.inset-0 {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.pointer-events-none {
    pointer-events: none;
}

/* Z-index */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }

/* Background Decor */
.bg-radial {
    background: radial-gradient(circle at center, #1a0a2e 0%, #0f0c29 30%, #000000 100%);
}

/* Space Blur Effect */
.bg-space-blur {
    background: 
        radial-gradient(circle at 20% 30%, rgba(138, 43, 226, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(75, 0, 130, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(25, 25, 112, 0.1) 0%, transparent 60%),
        radial-gradient(circle at 10% 80%, rgba(72, 61, 139, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 20%, rgba(123, 104, 238, 0.1) 0%, transparent 50%);
    filter: blur(60px);
    opacity: 0.8;
}

/* Stars Effect */
.stars {
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 60% 70%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(2px 2px at 80% 10%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 90% 40%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1px 1px at 33% 60%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(2px 2px at 66% 20%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 15% 80%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(2px 2px at 40% 90%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 70% 15%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 25% 45%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(2px 2px at 85% 55%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 5% 25%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(2px 2px at 95% 75%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 45% 5%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(1px 1px at 55% 95%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 12% 35%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(2px 2px at 75% 65%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 35% 15%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 65% 85%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(2px 2px at 8% 60%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 92% 30%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 28% 75%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(2px 2px at 72% 45%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 18% 50%, rgba(255, 255, 255, 0.7), transparent),
        radial-gradient(1px 1px at 88% 90%, rgba(255, 255, 255, 0.6), transparent),
        radial-gradient(2px 2px at 42% 25%, rgba(255, 255, 255, 0.8), transparent),
        radial-gradient(1px 1px at 58% 55%, rgba(255, 255, 255, 0.7), transparent);
    background-size: 200% 200%;
    background-position: 0% 0%, 100% 100%, 50% 50%, 80% 10%, 90% 40%, 33% 60%, 66% 20%, 15% 80%, 40% 90%, 70% 15%, 25% 45%, 85% 55%, 5% 25%, 95% 75%, 45% 5%, 55% 95%, 12% 35%, 75% 65%, 35% 15%, 65% 85%, 8% 60%, 92% 30%, 28% 75%, 72% 45%, 18% 50%, 88% 90%, 42% 25%, 58% 55%;
    animation: twinkle 8s ease-in-out infinite;
    opacity: 0.7;
    filter: blur(0.5px);
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.8;
    }
}

/* Header Styles */
.header-title {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: #fff;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header-subtitle {
    color: #a3a3a3;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header-subtitle .highlight {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: #ef4444;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* Header Positioning */
.top-8 {
    top: 2rem;
}

.left-0 {
    left: 0;
}

.right-0 {
    right: 0;
}

.bottom-0 {
    bottom: 0;
}

.text-center {
    text-align: center;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

/* Icon Styles */
.icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    stroke-width: 2;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.icon.w-8 {
    width: 2rem;
    height: 2rem;
}

.icon.h-8 {
    height: 2rem;
}

.icon.w-4 {
    width: 1rem;
    height: 1rem;
}

.icon.h-4 {
    height: 1rem;
}

.icon.w-6 {
    width: 1.5rem;
    height: 1.5rem;
}

.icon.h-6 {
    height: 1.5rem;
}

.icon.text-pink-500 {
    color: #ec4899;
}

.icon.text-neutral-500 {
    color: #737373;
}

/* Input Section */
.bg-gradient-to-t {
    background: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.8) 50%, transparent 100%);
}

.p-6 {
    padding: 1.5rem;
}

.max-w-xl {
    max-width: 36rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.flex-col {
    flex-direction: column;
}

.w-full {
    width: 100%;
}

/* Input Base Styles */
.input-base {
    background-color: rgba(10, 10, 10, 0.5);
    border: 1px solid #404040;
    border-radius: 0.75rem;
    color: #fff;
    outline: none;
    transition: all 0.15s ease-in-out;
    padding: 0.75rem 1rem;
    font-size: 16px; /* Minimum 16px to prevent zoom on Safari iOS */
    width: 100%;
    height: 48px;
    min-height: 48px;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.input-base::placeholder {
    color: #525252;
}

.input-base:focus {
    border-color: #ec4899;
    box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.2);
}

/* Thread ID Input */
.relative {
    position: relative;
}

.pl-9 {
    padding-left: 2.25rem;
}

.pr-4 {
    padding-right: 1rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Submit Button */
.button-submit {
    background-color: #fff;
    color: #000;
    padding: 0.75rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 48px;
    min-height: 48px;
}

.button-submit:hover:not(:disabled) {
    background-color: #e5e5e5;
}

.button-submit:active:not(:disabled) {
    background-color: #d4d4d4;
}

.button-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error Message */
.error-message {
    background-color: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.top-24 {
    top: 6rem;
}

.left-1\/2 {
    left: 50%;
}

.-translate-x-1\/2 {
    transform: translateX(-50%);
}

.-translate-y-1\/2 {
    transform: translateY(-50%);
}

.top-1\/2 {
    top: 50%;
}

.left-3 {
    left: 0.75rem;
}

.flex-1 {
    flex: 1 1 0%;
}

.text-xs {
    font-size: 0.75rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.rounded-full {
    border-radius: 9999px;
}

.hidden {
    display: none;
}

/* Footer Text */
.text-\[10px\] {
    font-size: 0.625rem;
}

.text-neutral-600 {
    color: #525252;
}

.mt-4 {
    margin-top: 1rem;
}

/* Animations */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

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

.transition-transform {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 1000ms;
}

.duration-1000 {
    transition-duration: 1000ms;
}

.ease-linear {
    transition-timing-function: linear;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .header-title {
        font-size: 1.25rem;
    }
    
    .header-subtitle {
        font-size: 0.75rem;
    }
    
    .top-8 {
        top: 1rem;
    }
    
    .p-6 {
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    #goal-form {
        gap: 0.75rem;
        width: 100%;
    }
    
    .input-base {
        font-size: 16px; /* Prevents zoom on iOS Safari */
        padding: 0.875rem 1rem;
        height: 48px;
        min-height: 48px;
        border: 1px solid #404040;
        box-sizing: border-box;
    }
    
    /* Ensure both input fields have same height */
    #threadsId-input,
    #goal-input {
        height: 48px;
        min-height: 48px;
    }
    
    .button-submit {
        padding: 0;
        min-width: 48px;
        min-height: 48px;
        width: 48px;
        height: 48px;
        border-radius: 0.75rem;
        flex-shrink: 0;
    }
    
    .icon.w-8 {
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .icon.w-6 {
        width: 1.25rem;
        height: 1.25rem;
    }
    
    .icon.w-4 {
        width: 1rem;
        height: 1rem;
    }
    
    .text-\[10px\] {
        font-size: 0.5625rem;
    }
    
    .top-24 {
        top: 4rem;
    }
    
    .gap-2 {
        gap: 0.5rem;
    }
    
    .gap-3 {
        gap: 0.75rem;
    }
    
    .max-w-xl {
        max-width: 100%;
    }
    
    /* Ensure input fields are properly aligned */
    #goal-form > div:last-child {
        display: flex;
        align-items: stretch;
        gap: 0.5rem;
        width: 100%;
    }
    
    #goal-input {
        flex: 1;
        min-width: 0;
    }
    
    #goal-form > div:first-child {
        width: 100%;
    }
    
    /* Fix form container */
    #goal-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
}

/* Tablet and Desktop */
@media (min-width: 768px) {
    .header-title {
        font-size: 2.25rem;
    }
    
    #goal-form {
        flex-direction: row;
        align-items: center;
    }
    
    #goal-form > div:first-child {
        width: 33.333333%;
    }
    
    #goal-form > div:last-child {
        width: 66.666667%;
    }
    
    .p-6 {
        padding: 2.5rem;
    }
    
    /* Ensure both input fields have same height on desktop */
    .input-base {
        height: 48px;
        min-height: 48px;
        font-size: 16px;
    }
    
    #threadsId-input,
    #goal-input {
        height: 48px;
        min-height: 48px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .button-submit {
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Input font size 16px prevents zoom on iOS Safari */
    .input-base {
        font-size: 16px;
        height: 48px;
        min-height: 48px;
    }
    
    /* Ensure both inputs have same height */
    #threadsId-input,
    #goal-input {
        height: 48px;
        min-height: 48px;
    }
    
    /* Ensure proper spacing on mobile */
    #goal-form {
        gap: 0.75rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .icon {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}
