/* ============================================
   AI Tools Hub - Main Styles
   Clean & Optimized
   ============================================ */

/* ========== LAYOUT ========== */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* ============================================
   Anti-Flicker Auth States
   ============================================ */
html.is-logged-in .show-logged-out {
    display: none !important;
}

html.is-logged-out .show-logged-in {
    display: none !important;
}

html:not(.is-admin) .show-admin {
    display: none !important;
}

/* ========== HEADER ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-light);
    transition: all var(--duration-base) var(--ease-smooth);
}

.header.scrolled {
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.95);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    gap: var(--space-4);
}

.logo {
    font-size: var(--text-2xl);
    font-weight: 800;
    background: var(--bg-gradient-1);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: transform var(--duration-fast) var(--ease-bounce);
}

.logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: var(--space-2);
    list-style: none;
    align-items: center;
}

.nav-link {
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius-lg);
    transition: all var(--duration-fast) var(--ease-smooth);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--bg-gradient-1);
    transform: translateX(-50%);
    transition: width var(--duration-base) var(--ease-smooth);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--interactive-hover);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 60%;
}

.nav-link.active {
    color: var(--accent-primary);
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-smooth);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left var(--duration-slow) var(--ease-smooth);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--bg-gradient-1);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-light);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    background: var(--interactive-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--interactive-hover);
    color: var(--text-primary);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ========== CARDS ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    border: 1px solid var(--border-light);
    transition: all var(--duration-base) var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bg-gradient-1);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--duration-base) var(--ease-smooth);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-primary);
}

.card:hover::before {
    transform: scaleX(1);
}

/* ========== HERO ========== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient-hero);
    padding-top: 80px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: float 8s ease-in-out infinite;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 20%;
    right: 10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite reverse;
}

.hero-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero-title {
    font-size: clamp(var(--text-4xl), 8vw, var(--text-5xl));
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: var(--space-6);
    background: var(--bg-gradient-1);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: var(--text-xl);
    color: var(--text-secondary);
    margin-bottom: var(--space-8);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-4);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-family: var(--font-primary);
    font-size: var(--text-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--duration-fast) var(--ease-smooth);
}

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

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

/* ========== ALERTS ========== */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    display: none;
    animation: slideDown var(--duration-base) var(--ease-smooth);
}

.alert.show {
    display: block;
}

.alert-success {
    background: var(--success-bg);
    color: var(--accent-success);
    border: 1px solid var(--accent-success);
}

.alert-error {
    background: var(--error-bg);
    color: var(--accent-error);
    border: 1px solid var(--accent-error);
}

/* ========== UTILITIES ========== */
.text-center {
    text-align: center;
}

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

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

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.hover-lift {
    transition: transform var(--duration-base) var(--ease-smooth);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

/* ========== SOCIAL MEDIA FOOTER ========== */
.creator-footer {
    background: var(--bg-gradient-hero);
    position: relative;
    overflow: hidden;
    padding: 60px 20px 40px;
    margin-top: 80px;
    border-top: 1px solid var(--border-light);
}

.creator-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.creator-footer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.3;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 40px;
    align-items: center;
}

.footer-brand {
    text-align: left;
}

.footer-brand h3 {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--bg-gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.social-link {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-primary);
    transition: all var(--duration-base) var(--ease-smooth);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.social-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    opacity: 0;
    transition: opacity var(--duration-base);
}

.social-link:hover {
    transform: translateY(-6px) scale(1.1);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-xl);
    background: var(--interactive-hover);
}

.social-link:hover::before {
    opacity: 1;
}

.social-link.github:hover { border-color: #333; background: #f8f8f8; }
.social-link.instagram:hover { border-color: #e1306c; background: #fff2f6; }
.social-link.facebook:hover { border-color: #1877f2; background: #f0f4ff; }

/* Dark Mode Social Link Overrides */
[data-theme="dark"] .social-link.github:hover { border-color: #f8f8f8; background: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .social-link.instagram:hover { border-color: #e1306c; background: rgba(225, 48, 108, 0.1); }
[data-theme="dark"] .social-link.facebook:hover { border-color: #1877f2; background: rgba(24, 119, 242, 0.1); }

.github:hover { color: #333; }
.instagram:hover { color: #e1306c; }
.facebook:hover { color: #1877f2; }

.footer-actions {
    text-align: right;
}

.footer-actions .btn {
    margin-bottom: 10px;
    display: block;
    text-align: center;
}

.footer-actions .btn:last-child {
    margin-bottom: 0;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
    border-top: 1px solid var(--border-light);
    margin-top: 40px;
}

.footer-bottom strong {
    color: var(--accent-primary);
    font-weight: 700;
}

/* ========== HEADER BADGE ========== */
.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-gradient-1);
    color: white;
    border-radius: 9999px;
    font-size: var(--text-sm);
    font-weight: 600;
    margin-left: 12px;
    box-shadow: var(--shadow-primary);
    transition: all var(--duration-base) var(--ease-smooth);
    animation: badgeSlide 0.8s ease-out;
}

.header-badge:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.header-badge .badge-icon {
    font-size: 1rem;
    animation: rotateSlow 15s linear infinite;
}

/* ========== CREATOR ZONE STYLES ========== */
.creator-zone {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-12);
}

.creator-card {
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius-2xl);
    padding: 4px; /* For gradient border */
    position: relative;
    overflow: hidden;
}

.creator-content {
    height: 470px;
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    position: relative;
    perspective: 1000px;
}

.creator-front,
.creator-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: var(--space-8);
}

.creator-back {
    transform: rotateY(180deg);
}

.creator-card.flipped .creator-front {
    transform: rotateY(-180deg);
}

.creator-card.flipped .creator-back {
    transform: rotateY(0deg);
}

.creator-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.creator-avatar {
    width: 80px;
    height: 80px;
    background: var(--bg-gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    box-shadow: var(--shadow-xl);
}

.creator-info h3 {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-bottom: 4px;
    background: var(--bg-gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.creator-info p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
}

.creator-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-item {
    text-align: center;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.stat-number {
    display: block;
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 600;
}

.creator-message {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-6);
    font-style: italic;
    border-left: 4px solid var(--accent-primary);
    padding-left: var(--space-4);
}

.creator-social-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.creator-social-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--duration-base) var(--ease-smooth);
}

.creator-social-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.creator-social-item .social-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
}

.creator-social-item.github:hover .social-icon { border-color: #333; background: #f8f8f8; }
.creator-social-item.instagram:hover .social-icon { border-color: #e1306c; background: #fff2f6; }
.creator-social-item.facebook:hover .social-icon { border-color: #1877f2; background: #f0f4ff; }

.social-name {
    font-weight: 700;
    font-size: var(--text-sm);
}

.social-handle {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ========== RESPONSIVE FOOTER ========== */
@media (max-width: 900px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 30px;
    }
    
    .footer-actions {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .creator-stats {
        grid-template-columns: 1fr;
    }
    
    .creator-social-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .creator-footer {
        padding: 40px 20px 30px;
    }
    
    .footer-brand h3 {
        font-size: var(--text-xl);
    }
    
    .creator-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    
    .creator-avatar {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .container {
        padding: 0 var(--space-4);
    }

    .hero {
        padding-top: 100px;
        min-height: 80vh;
    }

    .hero-title {
        font-size: var(--text-3xl);
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: var(--text-lg);
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .categories-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .creator-content {
        height: auto;
        min-height: 400px;
    }

    .creator-stats {
        grid-template-columns: 1fr 1fr;
    }

    .creator-social-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: var(--space-6);
    }

    .form-input,
    .form-textarea,
    .form-select {
        padding: var(--space-3);
        font-size: var(--text-base);
    }

    .btn {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-sm);
    }
}

/* Extra Small Devices (Phones) */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-3);
    }

    .hero-title {
        font-size: var(--text-2xl);
    }

    .hero-subtitle {
        font-size: var(--text-base);
    }

    .logo {
        font-size: var(--text-xl);
    }

    .creator-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .creator-stats {
        grid-template-columns: 1fr;
    }

    .creator-header {
        gap: var(--space-2);
    }

    .creator-info h3 {
        font-size: var(--text-xl);
    }

    .stat-item {
        padding: var(--space-3);
    }

    .stat-number {
        font-size: var(--text-lg);
    }

    .modal-content {
        padding: var(--space-4);
    }

    .footer-content {
        gap: 20px;
    }

    .social-links {
        gap: 15px;
    }

    .social-link {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .footer-actions .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }
}

/* Small Tablets (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .creator-stats {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .creator-social-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Large Tablets (1025px - 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .container {
        max-width: 1100px;
    }
}

/* Desktop (1201px and above) */
@media (min-width: 1201px) {
    .tools-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .categories-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .container {
        max-width: 1400px;
    }
}

/* Ultra Wide Screens */
@media (min-width: 1600px) {
    .container {
        max-width: 1600px;
    }

    .tools-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* High DPI/Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn::before {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    }
}

/* Dark Mode Specific Responsive */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .creator-content {
        background: var(--bg-card);
        border: 1px solid var(--border-light);
    }

    .creator-stats .stat-item {
        background: var(--bg-secondary);
        border: 1px solid var(--border-light);
    }
}

/* Print Styles */
@media print {
    .header,
    .creator-footer,
    .modal {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .container {
        max-width: none !important;
        padding: 0 !important;
    }

    a {
        text-decoration: none !important;
        color: black !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .creator-card {
        transition: none !important;
    }

    .creator-front,
    .creator-back {
        transition: none !important;
    }
}

/* Landscape Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 60vh;
        padding-top: 60px;
    }

    .hero-title {
        font-size: var(--text-2xl);
    }
}

/* Portrait Orientation */
@media (max-width: 768px) and (orientation: portrait) {
    .hero {
        min-height: 70vh;
        padding-top: 80px;
    }

    .creator-content {
        height: 500px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px; /* Apple recommended touch target */
        padding: var(--space-3) var(--space-6);
    }

    .nav-link {
        min-height: 44px;
        padding: var(--space-2) var(--space-3);
    }

    .creator-social-item {
        min-height: 44px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        color: #fff;
        border: 2px solid #000;
    }

    .btn-secondary {
        background: #fff;
        color: #000;
        border: 2px solid #000;
    }

    .creator-footer {
        background: #000;
        color: #fff;
    }
}

/* Low Contrast Mode */
@media (prefers-contrast: low) {
    .btn {
        opacity: 0.8;
    }

    .creator-footer {
        opacity: 0.9;
    }
}

/* Large Text Support */
@media (prefers-font-size-adjust: 1.2) {
    .hero-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .creator-info h3 {
        font-size: var(--text-2xl);
    }

    .stat-number {
        font-size: var(--text-2xl);
    }
}

/* Custom Scrollbar for Webkit */
@media (hover: hover) {
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    ::-webkit-scrollbar-track {
        background: var(--bg-secondary);
    }

    ::-webkit-scrollbar-thumb {
        background: var(--border-light);
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--accent-primary);
    }
}

/* Focus Management for Accessibility */
@media (prefers-reduced-motion: no-preference) {
    .btn:focus-visible,
    .nav-link:focus-visible,
    .form-input:focus-visible {
        outline: 3px solid var(--accent-primary);
        outline-offset: 2px;
    }
}

/* Container Queries Support (Future-proofing) */
@supports (container-type: inline-size) {
    .tools-grid {
        container-type: inline-size;
    }

    @container (max-width: 400px) {
        .tools-grid {
            grid-template-columns: 1fr;
        }
    }
}
