*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg-white: #ffffff;
    --bg-subtle: #f8fafc;
    --accent: #A01D26;
    --accent-dark: #8b1920;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-white);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Page Header */
.page-header {
    padding: 120px 24px 48px;
    text-align: center;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.page-header .subtitle {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Back Button */
.back-nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 24px 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--accent);
}

.back-link i {
    font-size: 12px;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Main Content */
.portfolio-detail {
    padding: 32px 0 64px;
}

/* Portfolio Header Card */
.detail-header {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
    margin-bottom: 32px;
}

.header-top {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.detail-icon {
    width: 72px;
    height: 72px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    flex-shrink: 0;
}

.header-info {
    flex: 1;
}

.header-info h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.header-industry {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.status-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-active { background: #dcfce7; color: #166534; }
.badge-incubation { background: #fef3c7; color: #92400e; }
.badge-closed { background: #f1f5f9; color: #475569; }
.badge-development { background: #dbeafe; color: #1e40af; }

/* Meta Info Row */
.meta-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.meta-item i {
    color: var(--accent);
    font-size: 14px;
}

.meta-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.meta-item span {
    color: var(--text-secondary);
}

/* Two Column Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 32px;
}

/* Content Sections */
.content-section {
    margin-bottom: 32px;
}

.content-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.section-title i {
    color: var(--accent);
    font-size: 14px;
}

.content-section p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Testimonial */
.testimonial-block {
    background: var(--bg-subtle);
    border-left: 3px solid var(--accent);
    padding: 20px 24px;
    border-radius: 0 8px 8px 0;
    margin: 24px 0;
}

.testimonial-text {
    font-size: 16px;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 12px;
}

.testimonial-author {
    font-size: 14px;
    color: var(--text-muted);
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.gallery-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-white);
}

.gallery-item img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}

.gallery-caption {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
}

/* Sidebar */
.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Sidebar Cards */
.sidebar-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-card-header {
    background: var(--text-primary);
    color: white;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-card-body {
    padding: 16px;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.service-active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.service-inactive {
    background: var(--bg-white);
    color: var(--text-muted);
    border: 1px solid var(--border);
    opacity: 0.6;
}

.service-item i {
    font-size: 12px;
}

/* Links List */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.link-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.link-item i {
    font-size: 14px;
    color: var(--text-muted);
}

.link-item:hover i {
    color: var(--accent);
}

/* Quick Facts */
.facts-list {
    display: flex;
    flex-direction: column;
}

.fact-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.fact-item:last-child {
    border-bottom: none;
}

.fact-label {
    color: var(--text-primary);
    font-weight: 500;
}

.fact-value {
    color: var(--text-secondary);
}

/* Related Projects Section */
.related-section {
    padding: 64px 0;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border);
}

.related-header {
    text-align: center;
    margin-bottom: 32px;
}

.related-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.related-header p {
    font-size: 15px;
    color: var(--text-secondary);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.related-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.related-card-image {
    height: 140px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
}

.related-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-card-body {
    padding: 16px;
}

.related-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.related-card-industry {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.related-card-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 80px 24px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-state p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 80px 24px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 32px 0;
}

.error-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.error-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

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

.error-state a:hover {
    text-decoration: underline;
}

.error-state .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.error-state .btn-primary:hover {
    background: var(--accent-dark);
    text-decoration: none;
}

/* CTA Section */
.cta-section {
    background: var(--text-primary);
    padding: 64px 0;
}

.cta-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: center;
}

.cta-container h2 {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.cta-container p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 32px;
}

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

.btn-primary {
    display: inline-block;
    padding: 14px 32px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: var(--accent-dark);
}

.btn-outline {
    display: inline-block;
    padding: 14px 32px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Hero Image */
.hero-image-section {
    margin-bottom: 32px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.hero-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    display: block;
}

/* Header Tagline */
.header-tagline {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-style: italic;
}

/* Tags Section */
.tags-section {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Client Card */
.client-card .client-logo {
    max-width: 120px;
    max-height: 60px;
    object-fit: contain;
    margin-bottom: 12px;
}

.client-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.client-company {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.client-website {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}

.client-website:hover {
    text-decoration: underline;
}

/* Timeline Info */
.timeline-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-label {
    color: var(--text-primary);
    font-weight: 500;
}

.timeline-value {
    color: var(--text-secondary);
}

/* Video Section */
.video-section .video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Before/After Section */
.before-after-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 16px;
}

.before-after-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.before-after-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.ba-label {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    background: var(--text-primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Features List */
.features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.features-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.features-list li:last-child {
    border-bottom: none;
}

.features-list li i {
    color: #16a34a;
    font-size: 14px;
    margin-top: 2px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.metric-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Tech Stack */
.tech-stack-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-badge {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Testimonial Rating */
.testimonial-rating {
    margin-bottom: 12px;
    color: #f59e0b;
    font-size: 16px;
}

.testimonial-rating i {
    margin-right: 2px;
}

/* Primary Link */
.link-primary {
    background: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
}

.link-primary i {
    color: white !important;
}

.link-primary:hover {
    background: var(--accent-dark) !important;
    border-color: var(--accent-dark) !important;
}

/* Featured Badge */
.featured-badge .fact-label {
    color: #f59e0b;
}

.featured-badge .fact-label i {
    color: #f59e0b;
}

/* Gallery with Lightbox */
.gallery-item {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 40px;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

.lightbox-close:hover {
    color: var(--accent);
}

/* Related Blogs Section */
.related-blogs-section {
    padding: 64px 0;
    background: var(--bg-white);
    border-top: 1px solid var(--border);
}

.related-blogs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.blog-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.2s ease;
}

.blog-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.blog-card-image {
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-card-body {
    padding: 16px;
}

.blog-category {
    display: inline-block;
    padding: 4px 8px;
    background: var(--bg-subtle);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.blog-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.blog-card-excerpt {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.blog-card-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

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

    .header-top {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

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

    .before-after-container {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 600px) {
    .page-header {
        padding: 100px 16px 32px;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .back-nav {
        padding: 16px 16px 0;
    }

    .container {
        padding: 0 16px;
    }

    .detail-header {
        padding: 24px;
    }

    .header-info h1 {
        font-size: 24px;
    }

    .meta-row {
        flex-direction: column;
        gap: 12px;
    }

    .related-grid,
    .related-blogs-grid {
        grid-template-columns: 1fr;
    }

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

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

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

    .cta-buttons {
        flex-direction: column;
    }

    .btn-primary,
    .btn-outline {
        width: 100%;
        text-align: center;
    }

    .hero-image {
        max-height: 300px;
    }

    .before-after-item img {
        height: 180px;
    }

    .lightbox {
        padding: 20px;
    }

    .lightbox-close {
        top: -30px;
        font-size: 28px;
    }
}
