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

html {
    scroll-behavior: smooth;
}

/* Custom scrollbar: чёрный трек, белый ползунок */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.4) #0a0a0a;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #000;
    color: #fff;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding-top: env(safe-area-inset-top, 0);
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo-text {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
}

.nav-menu {
    display: flex;
    gap: 40px;
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #ccc;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #fff;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: #fff;
    margin: 3px 0;
    transition: 0.3s;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    padding-top: calc(70px + env(safe-area-inset-top, 0px));
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 30px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 8s ease-in-out infinite;
    will-change: transform;
}

.shape-1 {
    width: 60px;
    height: 60px;
    top: 15%;
    left: 5%;
    animation-delay: 0s;
}

.shape-2 {
    width: 90px;
    height: 90px;
    top: 70%;
    left: 3%;
    animation-delay: 2s;
}

.shape-3 {
    width: 50px;
    height: 50px;
    top: 88%;
    left: 12%;
    animation-delay: 4s;
}

.shape-4 {
    width: 70px;
    height: 70px;
    top: 40%;
    left: 2%;
    animation-delay: 1s;
}

.shape-5 {
    width: 35px;
    height: 35px;
    top: 8%;
    left: 18%;
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.hero-inner {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 5rem;
    max-width: 1100px;
    width: 100%;
    min-width: 0;
}

.hero-content {
    width: 100%;
    min-width: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-visual {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.hero-visual .bust-image {
    width: 180px;
    height: 240px;
    object-fit: contain;
    opacity: 0;
    animation: fadeIn 1s ease forwards 1.5s;
    filter: none;
    border-radius: 20px;
    outline: none;
    border: none;
}

.hero-visual .bust-image:focus,
.hero-visual .bust-image:focus-visible {
    outline: none;
}

.david-bust {
    position: relative;
    width: 220px;
    height: 280px;
    opacity: 0;
    animation: fadeInBust 2s ease forwards 1.5s;
    will-change: transform;
}

.bust-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(1.05) contrast(1.05);
    animation: bustFloat 8s ease-in-out infinite;
    border-radius: 20px;
    outline: none;
    border: none;
}

.bust-image:focus,
.bust-image:focus-visible {
    outline: none;
}

@keyframes fadeInBust {
    from { 
        opacity: 0; 
        transform: scale(0.8) rotate(-5deg);
    }
    to { 
        opacity: 1; 
        transform: scale(1) rotate(0deg);
    }
}

@keyframes bustFloat {
    0%, 100% { 
        transform: rotate(0deg) scale(1);
        filter: brightness(1.05) contrast(1.05);
    }
    50% { 
        transform: translateY(-5px) rotate(2deg) scale(1.02);
        filter: brightness(1.1) contrast(1.05);
    }
}

/* David Silhouette for About Section */
.david-silhouette {
    width: 200px;
    height: 250px;
    object-fit: contain;
    opacity: 0;
    animation: fadeInSilhouette 1.5s ease forwards 0.5s;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.08)) brightness(1.05) contrast(1.05);
    border-radius: 15px;
}

@keyframes fadeInSilhouette {
    from { 
        opacity: 0; 
        transform: scale(0.7) rotate(-15deg);
    }
    to { 
        opacity: 1; 
        transform: scale(1) rotate(0deg);
    }
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 24px;
    width: 100%;
}

.title-line {
    display: block;
}

.title-line .typing-word,
.hero-subtitle .typing-word {
    white-space: nowrap;
    display: inline;
}

.title-line .typing-space,
.hero-subtitle .typing-space {
    white-space: pre;
    display: inline;
}

.title-line .typing-char {
    display: inline;
    opacity: 0;
    animation: typingReveal 0.4s ease forwards;
}

@keyframes typingReveal {
    to { opacity: 1; }
}

.accent {
    color: #fff;
}

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

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: #ccc;
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
}

.hero-subtitle-line1,
.hero-subtitle-line2 {
    display: block;
}

.hero-subtitle-line2 {
    margin-top: 0.25em;
}

.hero-subtitle .typing-char {
    display: inline;
    opacity: 0;
    animation: typingReveal 0.3s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.hero-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-buttons .btn {
    opacity: 0;
    transform: translateY(12px);
    animation: slideUp 0.6s ease forwards;
}

.hero-buttons .btn:nth-child(1) { animation-delay: 4.5s; }
.hero-buttons .btn:nth-child(2) { animation-delay: 4.65s; }
.hero-buttons .btn:nth-child(3) { animation-delay: 4.8s; }

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #fff;
    color: #000;
}

.btn-primary:hover {
    background: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

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

.btn-secondary:hover {
    background: #fff;
    color: #000;
    transform: translateY(-2px);
}

.scroll-indicator-wrapper {
    display: flex;
    justify-content: center;
    padding: 30px 0;
    background: linear-gradient(180deg, #000 0%, #080808 30%, #0d0d0d 70%, #111 100%);
}

.scroll-indicator {
    opacity: 0;
    animation: fadeIn 1s ease forwards 1.5s;
    z-index: 1;
}

.scroll-line {
    width: 2px;
    height: 40px;
    background: #fff;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.5; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.2); }
}

/* Section Styles */
.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.section-title.animate {
    opacity: 1;
    transform: translateY(0);
}

.section-subtitle {
    font-size: 1.2rem;
    color: #ccc;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease 0.2s;
}

.section-subtitle.animate {
    opacity: 1;
    transform: translateY(0);
}

/* Services Section */
.services {
    padding: 120px 0;
    position: relative;
    background: linear-gradient(180deg, #0a0a0a 0%, #0d0d0d 20%, #111 50%, #0d0d0d 80%, #0a0a0a 100%);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    margin-top: 60px;
}

.service-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(50px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.service-card.animate {
    opacity: 1;
    transform: translateY(0);
}

.service-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(255, 255, 255, 0.1);
}

.service-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 20px;
    margin: 0 auto 30px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.service-icon svg {
    width: 32px;
    height: 32px;
    color: #fff;
    transition: all 0.3s ease;
}

.service-icon:hover {
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

.service-icon:hover svg {
    color: #fff;
    transform: scale(1.1);
}

.service-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #fff;
}

.service-description {
    color: #ccc;
    line-height: 1.7;
}

/* Portfolio Section */
.portfolio {
    padding: 120px 0;
    position: relative;
    background: linear-gradient(180deg, #0a0a0a 0%, #080808 30%, #0a0a0a 70%, #0d0d0d 100%);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    margin-top: 60px;
}

.portfolio-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(50px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.portfolio-item.animate {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(255, 255, 255, 0.1);
}

.portfolio-image {
    position: relative;
    width: 100%;
    height: 250px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.portfolio-placeholder {
    color: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.portfolio-logo img {
    max-width: 140px;
    max-height: 140px;
    object-fit: contain;
    padding: 12px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.portfolio-logo-postypashki img,
.portfolio-logo-elanza img,
.portfolio-logo-ysf img {
    max-width: 120px;
    max-height: 120px;
    filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 26px rgba(255, 255, 255, 0.55));
}

.portfolio-item:hover .portfolio-logo img {
    transform: scale(1.06);
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 1)) drop-shadow(0 0 32px rgba(255, 255, 255, 0.7));
}

.portfolio-item:hover .portfolio-placeholder {
    color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.portfolio-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.portfolio-link svg {
    width: 20px;
    height: 20px;
}

.portfolio-content {
    padding: 30px;
}

.portfolio-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
}

.portfolio-description {
    color: #ccc;
    line-height: 1.7;
    margin-bottom: 20px;
    font-size: 1rem;
}

.portfolio-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #ccc;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.portfolio-github {
    text-align: center;
    margin-top: 60px;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.github-link svg {
    width: 20px;
    height: 20px;
}

.github-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.github-badge:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

.github-badge svg {
    width: 20px;
    height: 20px;
}

.footer-social {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-2px);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

/* About Section */
.about {
    padding: 120px 0;
    position: relative;
    background: linear-gradient(180deg, #0a0a0a 0%, #000 30%, #000 70%, #080808 100%);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.about-description {
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 30px;
    line-height: 1.7;
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease;
}

.about-description.animate {
    opacity: 1;
    transform: translateX(0);
}

.stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
}

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

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
}

.stat-label {
    color: #ccc;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.about-visual {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visual-element {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Removed visual circles around images */

/* FAQ Section */
.faq {
    padding: 120px 0;
    position: relative;
    background: linear-gradient(180deg, #0d0d0d 0%, #111 30%, #111 70%, #0d0d0d 100%);
}

.faq-list {
    max-width: 900px;
    margin: 0 auto;
}

.faq-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(30px);
    cursor: pointer;
}

.faq-item.animate {
    opacity: 1;
    transform: translateY(0);
}

.faq-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

.faq-question {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.faq-question-text {
    flex: 1;
    word-break: break-word;
}

.faq-question-star {
    flex-shrink: 0;
    opacity: 0.6;
    transform-origin: 50% 50%;
    transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}

.faq-question-star .inlogostar {
    fill: #666666;
    transition: fill 0.3s ease;
}

.faq-item:hover .faq-question-star {
    opacity: 0.85;
}

.faq-item.faq-item-active .faq-question-star {
    opacity: 1;
    transform: rotate(45deg) scale(1.15);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.7));
}

.faq-item.faq-item-active .faq-question-star .inlogostar {
    fill: #ffffff;
}

@keyframes faqStarTwinkle {
    0% {
        transform: scale(1) rotate(0deg);
        filter: none;
        opacity: 0.6;
    }
    30% {
        transform: scale(1.3) rotate(15deg);
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.7));
        opacity: 1;
    }
    60% {
        transform: scale(1.1) rotate(-10deg);
        filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.9));
        opacity: 0.9;
    }
    100% {
        transform: scale(1) rotate(0deg);
        filter: none;
        opacity: 0.6;
    }
}

.faq-question-star.twinkle-once {
    animation: faqStarTwinkle 0.9s ease-out;
}

.faq-question-star {
    position: relative;
}

.faq-question-star::after {
    content: '';
    position: absolute;
    left: -120%;
    top: 50%;
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
}

@keyframes faqStarGlint {
    0% {
        left: -120%;
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        left: 140%;
        opacity: 0;
    }
}

.faq-question-star.twinkle-once::after {
    animation: faqStarGlint 0.9s ease-out;
}

.faq-answer {
    color: #ccc;
    line-height: 1.7;
    font-size: 1rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin-top 0.25s ease;
}

.faq-item.faq-item-active .faq-answer {
    opacity: 1;
    margin-top: 14px;
}

.faq-answer p {
    margin: 0;
    word-break: break-word;
}

/* Contact Section */
.contact {
    padding: 120px 0;
    position: relative;
    background: linear-gradient(180deg, #0d0d0d 0%, #0a0a0a 40%, #050505 80%, #000 100%);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    margin-top: 60px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 20px;
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease;
}

.contact-item.animate {
    opacity: 1;
    transform: translateX(0);
}

.contact-details h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: #fff;
}

.contact-details p {
    color: #ccc;
    font-size: 1rem;
}

.contact-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    margin-right: 20px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.contact-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
    transition: all 0.3s ease;
}

.contact-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.contact-icon:hover svg {
    color: #fff;
    transform: scale(1.1);
}

.contact-form {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s ease;
}

.contact-form.animate {
    opacity: 1;
    transform: translateX(0);
}

.form-group {
    margin-bottom: 25px;
}

.form-input {
    width: 100%;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: #888;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.btn-full {
    width: 100%;
}

/* Footer */
.footer {
    padding: 60px 0;
    background: #000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-link {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: #fff;
}

.footer-copyright {
    color: #888;
    font-size: 0.9rem;
}

/* Tablet and medium screens — фото под текстом, чтобы не перекрывать */
@media (max-width: 1100px) {
    .hero-inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 2.5rem;
    }

    .hero-visual {
        order: 2;
        justify-content: center;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .david-bust {
        width: 140px;
        height: 180px;
    }

    .david-silhouette {
        width: 220px;
        height: 280px;
        opacity: 0.9;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero {
        padding-top: calc(70px + env(safe-area-inset-top, 0px));
    }

    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

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

    .hero-buttons {
        justify-content: center;
        gap: 12px;
    }

    .hero-visual .bust-image {
        width: 120px;
        height: 160px;
    }

    .floating-shapes .shape {
        opacity: 0.3;
    }

    .hero-title {
        font-size: clamp(2rem, 6vw, 3.5rem);
    }

    .hero-subtitle {
        font-size: 0.95rem;
        margin-bottom: 24px;
        max-width: 100%;
        word-break: break-word;
    }

    .hero-subtitle .typing-word,
    .hero-subtitle .typing-space {
        white-space: normal;
    }

    .hero-subtitle-line1,
    .hero-subtitle-line2 {
        display: block;
    }

    .hero-subtitle-line2 {
        margin-top: 0.25em;
    }

    .service-card {
        padding: 28px 20px;
    }

    .portfolio-image {
        height: 180px;
    }

    .section-header {
        margin-bottom: 50px;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: rgba(0, 0, 0, 0.95);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        backdrop-filter: blur(10px);
        padding: 20px 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu a {
        padding: 15px;
        display: block;
    }

    .hamburger {
        display: flex;
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }

    .stats {
        justify-content: center;
        gap: 30px;
    }

    .stat-item {
        min-width: 80px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .portfolio-image {
        height: 200px;
    }

    .faq-item {
        padding: 20px;
    }

    .faq-question {
        font-size: 1.1rem;
    }

    .faq-answer {
        font-size: 0.95rem;
    }

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

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

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero {
        gap: 1rem;
        padding-left: 15px;
        padding-right: 15px;
    }

    .hero-title {
        font-size: 2.1rem;
        line-height: 1.2;
        max-width: 100%;
    }

    .hero-subtitle .typing-word,
    .hero-subtitle .typing-space {
        white-space: normal;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-subtitle-line1,
    .hero-subtitle-line2 {
        display: block;
    }

    .hero-subtitle-line2 {
        margin-top: 0.25em;
    }

    .hero-subtitle {
        display: block;
    }

    .david-bust {
        width: 70px;
        height: 90px;
        opacity: 0.15;
        animation: none;
    }

    .david-bust img,
    .bust-image {
        animation: none;
    }

    .floating-shapes .shape {
        display: none;
    }

    .section-title {
        font-size: 2rem;
    }

    .service-card {
        padding: 30px 20px;
    }

    .stats {
        flex-direction: column;
        gap: 25px;
        align-items: center;
    }

    .stat-item {
        text-align: center;
        min-width: 100px;
    }

    .stat-number {
        font-size: 2.2rem;
        margin-bottom: 8px;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }

    .david-silhouette {
        width: 160px;
        height: 200px;
        opacity: 0.8;
    }

    .faq {
        padding: 80px 0;
    }

    .faq-item {
        padding: 16px 14px;
    }

    .faq-question {
        font-size: 1rem;
        gap: 10px;
    }

    .faq-question-star {
        width: 18px;
        height: 18px;
    }

    .faq-answer {
        font-size: 0.9rem;
    }

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

    .about-github .github-badge {
        justify-content: center;
        width: 100%;
        max-width: 260px;
    }

    /* Прятать превью у всех проектов, кроме первого (Поступашки) */
    .portfolio-item:not(:first-child) .portfolio-image {
        display: none;
    }
}

/* iPhone specific optimizations */
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    .hero {
        padding-top: calc(70px + env(safe-area-inset-top, 20px));
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .david-bust {
        width: 70px;
        height: 90px;
        opacity: 0.12;
    }

    .david-silhouette {
        width: 140px;
        height: 175px;
        opacity: 0.8;
    }
}

@media only screen and (device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) {
    .hero-title {
        font-size: 3rem;
    }

    .david-bust {
        width: 70px;
        height: 90px;
        opacity: 0.15;
    }

    .david-silhouette {
        width: 150px;
        height: 190px;
        opacity: 0.8;
    }
}

/* Additional animations for better UX */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Removed old icon-circle hover animation */

/* Image hover effects — без усиления контура */
.bust-image:hover {
    filter: brightness(1.05);
    transform: scale(1.02);
    transition: all 0.3s ease;
}

.david-silhouette:hover {
    filter: drop-shadow(0 0 25px rgba(255, 255, 255, 0.15)) brightness(1.05);
    transform: scale(1.05);
    transition: all 0.3s ease;
}

/* Smooth scrolling for iOS */
@supports (-webkit-overflow-scrolling: touch) {
    html {
        -webkit-overflow-scrolling: touch;
    }
}

/* Preloader Styles */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000 0%, #111 50%, #000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-container {
    text-align: center;
    position: relative;
    z-index: 2;
}

.preloader-logo {
    margin-bottom: 40px;
    position: relative;
}

.preloader-logo .logo-text {
    font-size: 4rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 4px;
    display: block;
    animation: logoGlow 2s ease-in-out infinite alternate;
}

.logo-underline {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    margin: 15px auto 0;
    border-radius: 2px;
    animation: underlineExpand 2s ease-in-out infinite;
}

@keyframes logoGlow {
    0% {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    100% {
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.6), 0 0 30px rgba(255, 255, 255, 0.3);
    }
}

@keyframes underlineExpand {
    0% {
        width: 0;
        opacity: 0;
    }
    50% {
        width: 100px;
        opacity: 1;
    }
    100% {
        width: 150px;
        opacity: 0.5;
    }
}

.preloader-text {
    margin-bottom: 50px;
}

.loading-text {
    font-size: 1.2rem;
    color: #ccc;
    font-weight: 300;
    display: block;
    margin-bottom: 20px;
    animation: textFade 2s ease-in-out infinite;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes textFade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.preloader-progress {
    width: 300px;
    margin: 0 auto;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #fff, #ccc, #fff);
    border-radius: 2px;
    width: 0%;
    animation: progressFill 3s ease-in-out forwards;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: progressShine 1.5s ease-in-out infinite;
}

@keyframes progressFill {
    0% { width: 0%; }
    20% { width: 25%; }
    40% { width: 50%; }
    60% { width: 75%; }
    80% { width: 90%; }
    100% { width: 100%; }
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.9rem;
    color: #888;
    font-weight: 500;
}

.preloader-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    animation: shapeFloat 8s ease-in-out infinite;
}

.bg-shape.shape-1 {
    width: 60px;
    height: 60px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.bg-shape.shape-2 {
    width: 100px;
    height: 100px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.bg-shape.shape-3 {
    width: 40px;
    height: 40px;
    top: 80%;
    left: 20%;
    animation-delay: 4s;
}

.bg-shape.shape-4 {
    width: 80px;
    height: 80px;
    top: 30%;
    right: 30%;
    animation-delay: 1s;
}

.bg-shape.shape-5 {
    width: 50px;
    height: 50px;
    top: 10%;
    right: 50%;
    animation-delay: 3s;
}

@keyframes shapeFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-30px) rotate(180deg);
        opacity: 0.6;
    }
}

/* Mobile preloader adjustments */
@media (max-width: 768px) {
    .preloader-logo .logo-text {
        font-size: 3rem;
        letter-spacing: 2px;
    }
    
    .preloader-progress {
        width: 250px;
    }
    
    .loading-text {
        font-size: 1rem;
    }
    
    .bg-shape {
        display: none;
    }
}

@media (max-width: 480px) {
    .preloader-logo .logo-text {
        font-size: 2.5rem;
    }
    
    .preloader-progress {
        width: 200px;
    }
}

/* Lead Magnet Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #ccc;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #fff;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #fff;
}

.modal-subtitle {
    color: #ccc;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

.lead-magnet-form .form-group {
    margin-bottom: 20px;
}

.lead-magnet-hint {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.lead-magnet-hint-error {
    color: #e74c3c;
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9990;
    animation: chatWidgetAppear 0.5s ease 1.5s both;
}

@keyframes chatWidgetAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    color: #000;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #f44;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    min-width: 280px;
    max-width: min(600px, calc(100vw - 48px));
    height: 400px;
    min-height: 200px;
    max-height: calc(100vh - 120px);
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

/* Resize handles — по краям и углам */
.chat-resize-handle {
    position: absolute;
    z-index: 10;
    background: transparent;
}

.chat-resize-handle[data-resize="n"] { top: 0; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.chat-resize-handle[data-resize="s"] { bottom: 0; left: 8px; right: 8px; height: 8px; cursor: ns-resize; }
.chat-resize-handle[data-resize="e"] { right: 0; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.chat-resize-handle[data-resize="w"] { left: 0; top: 8px; bottom: 8px; width: 8px; cursor: ew-resize; }
.chat-resize-handle[data-resize="nw"] { top: 0; left: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.chat-resize-handle[data-resize="ne"] { top: 0; right: 0; width: 16px; height: 16px; cursor: nesw-resize; }
.chat-resize-handle[data-resize="sw"] { bottom: 0; left: 0; width: 16px; height: 16px; cursor: nesw-resize; }
.chat-resize-handle[data-resize="se"] { bottom: 0; right: 0; width: 16px; height: 16px; cursor: nwse-resize; }

.chat-resize-handle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-widget.open .chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #fff;
}

.chat-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #ccc;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.chat-close:hover {
    color: #fff;
}

.chat-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.chat-contacts-step p {
    color: #ccc;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.chat-contacts-step .form-group {
    margin-bottom: 16px;
}

.chat-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #999;
    line-height: 1.5;
}

.chat-consent input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #fff;
    cursor: pointer;
}

.chat-consent a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: underline;
}

.chat-consent a:hover {
    color: #fff;
}

.chat-contacts-step .btn {
    margin-top: 0;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 16px;
}

.chat-messages.chat-drag-over {
    position: relative;
}

.chat-messages.chat-drag-over::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed rgba(34, 197, 94, 0.6);
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.08);
    pointer-events: none;
    animation: chatDragPulse 1s ease-in-out infinite;
}

@keyframes chatDragPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.chat-message {
    margin-bottom: 16px;
    max-width: 85%;
}

.chat-message.user {
    margin-left: auto;
}

.chat-message.agent {
    margin-right: auto;
}

.chat-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    overflow: hidden;
    min-width: 0;
}

.chat-message.user .chat-message-bubble {
    background: #fff;
    color: #000;
    border-bottom-right-radius: 4px;
}

.chat-message.agent .chat-message-bubble {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-message-time {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-attach {
    width: 44px;
    height: 44px;
    min-width: 44px;
    flex-shrink: 0;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-attach:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-attach img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.chat-file-link,
.chat-file-item {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chat-file-item.chat-file-previewable {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    cursor: default;
}

.chat-file-download-img {
    margin-top: 2px;
}

.chat-message.agent .chat-file-link,
.chat-message.agent .chat-file-item,
.chat-message.agent .chat-file-card {
    color: #fff;
}

.chat-message.agent .chat-file-link:hover,
.chat-message.agent .chat-file-item:hover,
.chat-message.agent .chat-file-card:hover {
    color: #ccc;
}

.chat-message.user .chat-file-link,
.chat-message.user .chat-file-item,
.chat-message.user .chat-file-card {
    color: #111;
}

.chat-message.user .chat-file-link:hover,
.chat-message.user .chat-file-item:hover,
.chat-message.user .chat-file-card:hover {
    color: #333;
}

.chat-file-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.chat-file-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 280px;
    box-sizing: border-box;
    transition: background 0.2s;
}

.chat-message.user .chat-file-card {
    background: rgba(0, 0, 0, 0.06);
}

.chat-message.user .chat-file-card:hover {
    background: rgba(0, 0, 0, 0.1);
}

.chat-message.agent .chat-file-card {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-message.agent .chat-file-card:hover {
    background: rgba(255, 255, 255, 0.18);
}

.chat-file-card-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-message.user .chat-file-card-icon {
    background: #4b5563;
}

.chat-message.agent .chat-file-card-icon {
    background: rgba(255, 255, 255, 0.15);
}

.chat-file-card-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: invert(1) brightness(1.1);
}

.chat-file-card-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.chat-file-card-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.chat-file-download {
    font-size: 0.75rem;
    margin-top: 4px;
    padding: 2px 0;
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}

.chat-file-download:hover {
    color: #0056b3;
}

.chat-message.agent .chat-file-download {
    color: #64b5f6;
}

.chat-message.agent .chat-file-download:hover {
    color: #90caf9;
}

.chat-file-quick-preview {
    position: fixed;
    z-index: 100000;
    max-width: 360px;
    max-height: 400px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: chatPreviewFadeIn 0.2s ease;
}

@keyframes chatPreviewFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.chat-file-quick-preview img {
    display: block;
    max-width: 100%;
    max-height: 360px;
    object-fit: contain;
}

.chat-file-quick-preview iframe {
    width: 360px;
    height: 400px;
    border: none;
}

.chat-file-quick-preview-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-file-quick-preview-name {
    font-weight: 500;
    color: #fff;
}

.chat-file-quick-preview-hint {
    font-size: 0.85rem;
    color: #888;
}

.chat-upload-progress {
    opacity: 0;
    animation: chatUploadAppear 0.3s ease forwards;
}

@keyframes chatUploadAppear {
    to { opacity: 1; }
}

.chat-upload-bubble {
    min-width: 200px;
}

.chat-upload-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.chat-upload-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.08);
}

.chat-message.user .chat-upload-icon {
    background: rgba(0, 0, 0, 0.06);
}

.chat-upload-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.chat-upload-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.chat-upload-speed {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #22c55e;
}

.chat-upload-main {
    flex: 1;
    min-width: 0;
}

.chat-upload-header {
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-word;
}

.chat-upload-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.chat-message.user .chat-upload-bar {
    background: rgba(0, 0, 0, 0.08);
}

.chat-upload-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 3px;
    transition: width 0.25s ease-out;
    min-width: 2%;
}

.chat-upload-fill[data-pct="0"] {
    animation: chatUploadPulse 1.5s ease-in-out infinite;
}

@keyframes chatUploadPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.chat-upload-size {
    font-size: 0.75rem;
    color: #666;
}

.chat-message.agent .chat-upload-size {
    color: rgba(255, 255, 255, 0.7);
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 100px;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-input::placeholder {
    color: #888;
}

.chat-send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: #fff;
    color: #000;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.chat-send:hover {
    opacity: 0.9;
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Contact chat hint */
.contact-chat-hint {
    margin-top: 16px;
    color: #888;
    font-size: 0.95rem;
}

.link-btn {
    background: none;
    border: none;
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
}

.link-btn:hover {
    color: #ccc;
}
