/**
 * Services Page Styles
 */

/* ═══════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════ */

.page-header {
    position: relative;
    padding-top: calc(var(--space-24) + var(--space-16));
    padding-bottom: var(--space-16);
    overflow: hidden;
}

.page-header-bg {
    position: absolute;
    inset: 0;
    z-index: var(--z-below);
}

.page-header-gradient {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 150%;
    height: 150%;
    background: radial-gradient(
        ellipse at center top,
        rgba(99, 102, 241, 0.12) 0%,
        rgba(139, 92, 246, 0.06) 30%,
        transparent 60%
    );
}

.page-title {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tighter);
    margin-bottom: var(--space-6);
    max-width: 800px;
}

.page-description {
    font-size: var(--text-xl);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    max-width: 640px;
}

@media (max-width: 768px) {
    .page-header {
        min-height: 70svh;
        padding-top: calc(var(--space-24) + var(--space-12));
        padding-bottom: var(--space-16);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .page-title {
        font-size: clamp(2.5rem, 10vw, 3.5rem);
    }
    
    .page-description {
        font-size: var(--text-xl);
    }
}

/* ═══════════════════════════════════════════
   SERVICE SECTIONS
═══════════════════════════════════════════ */

.service-section {
    border-top: 1px solid var(--color-border-subtle);
}

.service-section--alt {
    background: var(--color-bg-secondary);
}

.service-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
    align-items: center;
}

.service-detail--reverse {
    direction: rtl;
}

.service-detail--reverse > * {
    direction: ltr;
}

.service-number {
    display: block;
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.3;
    line-height: 1;
    margin-bottom: var(--space-4);
    transition: opacity 0.3s ease;
}

.service-detail:hover .service-number {
    opacity: 0.6;
}

.service-detail-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-4);
}

.service-detail-lead {
    font-size: var(--text-lg);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
}

.service-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.feature {
    position: relative;
    padding-left: var(--space-4);
    border-left: 2px solid var(--color-border-subtle);
    transition: border-color 0.3s ease;
}

.feature:hover {
    border-color: var(--color-accent-primary);
}

.feature h4 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.feature p {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-tertiary);
}

.service-stack {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border-subtle);
}

.stack-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

@media (max-width: 900px) {
    .service-detail {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .service-detail--reverse {
        direction: ltr;
    }

    .service-detail-visual {
        order: -1;
    }
}

/* ═══════════════════════════════════════════
   WORKFLOW PREVIEW (MVC Section)
═══════════════════════════════════════════ */

.workflow-preview {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: transform 0.4s var(--ease-expo-out), box-shadow 0.4s ease;
}

.workflow-preview:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow-md);
}

.workflow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border-subtle);
}

.workflow-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.workflow-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    padding: var(--space-1) var(--space-3);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-full);
}

.workflow-status--active {
    color: #10b981;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.workflow-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    transition: background 0.2s ease;
}

.workflow-step:hover {
    background: var(--color-bg-secondary);
}

.step-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-subtle);
    border-radius: 50%;
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.step-icon svg {
    width: 18px;
    height: 18px;
}

.workflow-step--done .step-icon {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.workflow-step--active .step-icon {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
    color: #6366f1;
}

.step-icon--pulse {
    animation: iconPulse 2s infinite;
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.step-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-label {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
}

.workflow-step--done .step-label {
    color: var(--color-text-secondary);
}

.step-time {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.workflow-step--active .step-time {
    color: #6366f1;
    font-weight: var(--font-medium);
}

.workflow-connector {
    width: 2px;
    height: 16px;
    background: var(--color-border-subtle);
    margin-left: 20px;
}

.workflow-connector--done {
    background: linear-gradient(to bottom, #10b981, rgba(16, 185, 129, 0.3));
}

.workflow-footer {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border-subtle);
}

.workflow-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
}

.stat-value {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

/* ═══════════════════════════════════════════
   CODE BLOCK
═══════════════════════════════════════════ */

.code-block {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border-subtle);
}

.code-file {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--color-text-tertiary);
}

.code-content {
    padding: var(--space-6);
    overflow-x: auto;
    background: var(--color-bg-primary);
}

.code-content code {
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
    background: none;
    padding: 0;
}

.code-keyword { color: #c792ea; }
.code-class { color: #ffcb6b; }
.code-function { color: #82aaff; }
.code-type { color: #f78c6c; }
.code-string { color: #c3e88d; }
.code-comment { color: #546e7a; font-style: italic; }

/* ═══════════════════════════════════════════
   DASHBOARD PREVIEW
═══════════════════════════════════════════ */

.dashboard-preview {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    transition: transform 0.4s var(--ease-expo-out), box-shadow 0.4s ease;
}

.dashboard-preview:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow-md);
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeSlideUp 0.5s var(--ease-expo-out) both;
    animation-delay: 0.1s;
}

.dash-title-bar {
    height: 20px;
    width: 150px;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-md);
}

.dash-actions {
    display: flex;
    gap: var(--space-2);
}

.dash-btn {
    width: 60px;
    height: 28px;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-md);
    transition: transform 0.2s var(--ease-expo-out);
}

.dash-btn:hover {
    transform: scale(1.05);
}

.dash-btn--primary {
    width: 80px;
    background: var(--gradient-accent);
}

.dash-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.dash-metric {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    animation: fadeSlideUp 0.5s var(--ease-expo-out) both;
    transition: border-color 0.3s ease, transform 0.3s var(--ease-expo-out);
}

.dash-metric:nth-child(1) { animation-delay: 0.15s; }
.dash-metric:nth-child(2) { animation-delay: 0.2s; }
.dash-metric:nth-child(3) { animation-delay: 0.25s; }

.dash-metric:hover {
    border-color: var(--color-border-default);
    transform: translateY(-2px);
}

.metric-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-accent-soft);
    border-radius: var(--radius-md);
}

.metric-value {
    height: 14px;
    width: 50px;
    background: var(--color-bg-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-1);
}

.metric-label {
    height: 10px;
    width: 70px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
}

.dash-chart {
    height: 100px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    animation: fadeSlideUp 0.5s var(--ease-expo-out) both;
    animation-delay: 0.3s;
}

.dash-chart svg {
    width: 100%;
    height: 100%;
}

/* ═══════════════════════════════════════════
   PERFORMANCE CARD
═══════════════════════════════════════════ */

.performance-card {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: transform 0.4s var(--ease-expo-out), box-shadow 0.4s ease;
}

.performance-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow-md);
}

.perf-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.perf-title {
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.perf-scores {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

.perf-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    animation: fadeSlideUp 0.5s var(--ease-expo-out) both;
}

.perf-score:nth-child(1) { animation-delay: 0.1s; }
.perf-score:nth-child(2) { animation-delay: 0.15s; }
.perf-score:nth-child(3) { animation-delay: 0.2s; }

.perf-score svg {
    width: 80px;
    height: 80px;
}

.perf-circle {
    position: relative;
    width: 80px;
    height: 80px;
}

.perf-circle svg {
    width: 100%;
    height: 100%;
}

.perf-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: #10b981;
}

.perf-label {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

/* ═══════════════════════════════════════════
   INTEGRATION DIAGRAM
═══════════════════════════════════════════ */

.integration-diagram {
    position: relative;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.int-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    transition: 
        border-color var(--transition-normal),
        box-shadow var(--transition-normal),
        transform 0.3s var(--ease-expo-out);
    animation: fadeSlideUp 0.5s var(--ease-expo-out) both;
}

.int-node:hover {
    border-color: var(--color-border-accent);
    box-shadow: var(--shadow-glow-sm);
    transform: scale(1.05) translateX(var(--tx, 0)) translateY(var(--ty, 0));
}

.int-node--center {
    width: 100px;
    height: 100px;
    background: var(--gradient-accent-soft);
    border-color: var(--color-border-accent);
    z-index: 2;
    animation-delay: 0.1s;
}

.int-node--center svg {
    width: 32px;
    height: 32px;
    color: var(--color-accent-primary);
    transition: transform 0.3s var(--ease-expo-out);
}

.int-node--center:hover svg {
    transform: rotate(180deg);
}

.int-node--1 { 
    --tx: -50%; 
    top: 10%; 
    left: 50%; 
    transform: translateX(-50%);
    animation-delay: 0.2s;
}
.int-node--2 { 
    --ty: -50%; 
    top: 50%; 
    right: 5%; 
    transform: translateY(-50%);
    animation-delay: 0.25s;
}
.int-node--3 { 
    --tx: -50%; 
    bottom: 10%; 
    left: 50%; 
    transform: translateX(-50%);
    animation-delay: 0.3s;
}
.int-node--4 { 
    --ty: -50%; 
    top: 50%; 
    left: 5%; 
    transform: translateY(-50%);
    animation-delay: 0.35s;
}

.int-connections {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.int-line {
    position: absolute;
    background: var(--color-border-subtle);
    transition: background 0.3s ease;
}

.integration-diagram:hover .int-line {
    background: var(--color-accent-primary);
    opacity: 0.5;
}

.int-line--1 {
    width: 1px;
    height: 60px;
    left: 50%;
    top: calc(10% + 40px);
    transform: translateX(-50%);
}

.int-line--2 {
    width: 60px;
    height: 1px;
    right: calc(5% + 60px);
    top: 50%;
    transform: translateY(-50%);
}

.int-line--3 {
    width: 1px;
    height: 60px;
    left: 50%;
    bottom: calc(10% + 40px);
    transform: translateX(-50%);
}

.int-line--4 {
    width: 60px;
    height: 1px;
    left: calc(5% + 60px);
    top: 50%;
    transform: translateY(-50%);
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE - 768px
═══════════════════════════════════════════ */

@media (max-width: 768px) {
    .service-detail {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .service-detail--reverse {
        direction: ltr;
    }

    .service-detail-visual {
        order: -1;
    }

    .service-detail-title {
        font-size: var(--text-2xl);
    }

    .service-detail-lead {
        font-size: var(--text-base);
    }

    .service-number {
        font-size: var(--text-4xl);
    }

    .dash-metrics {
        display: none;
    }
    
    .dash-chart {
        height: 80px;
    }

    /* Reduce workflow preview on mobile */
    .workflow-preview {
        padding: var(--space-4);
    }
    
    .workflow-footer {
        display: none;
    }
    
    .workflow-step:last-child {
        display: none;
    }
    
    .workflow-connector:last-of-type {
        display: none;
    }
    
    .perf-scores {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
    }

    .perf-circle {
        width: 60px;
        height: 60px;
    }

    .perf-value {
        font-size: var(--text-base);
    }

    .code-block {
        margin: 0 calc(var(--space-4) * -1);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .code-content {
        padding: var(--space-4);
    }

    .code-content code {
        font-size: var(--text-xs);
    }

    .dashboard-preview {
        padding: var(--space-4);
    }

    .service-stack {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .stack-tags {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .integration-diagram {
        height: 260px;
    }

    .int-node--center {
        width: 70px;
        height: 70px;
    }

    .int-node--center svg {
        width: 24px;
        height: 24px;
    }

    .int-node--center span {
        font-size: 10px;
    }

    .int-node {
        padding: var(--space-2);
        font-size: 10px;
    }

    .int-node--1 { 
        top: 5%; 
    }
    .int-node--2 { 
        right: 2%; 
    }
    .int-node--3 { 
        bottom: 5%; 
    }
    .int-node--4 { 
        left: 2%; 
    }

    .int-line--1 {
        height: 45px;
        top: calc(5% + 30px);
    }

    .int-line--2 {
        width: 45px;
        right: calc(2% + 50px);
    }

    .int-line--3 {
        height: 45px;
        bottom: calc(5% + 30px);
    }

    .int-line--4 {
        width: 45px;
        left: calc(2% + 50px);
    }
}

/* ═══════════════════════════════════════════
   SMALL MOBILE - 480px
═══════════════════════════════════════════ */

@media (max-width: 480px) {
    .page-header {
        padding-top: calc(var(--space-20) + var(--space-4));
        padding-bottom: var(--space-8);
    }

    .page-title {
        font-size: var(--text-3xl);
    }

    .page-description {
        font-size: var(--text-base);
    }

    .service-detail-title {
        font-size: var(--text-xl);
    }

    .service-number {
        font-size: var(--text-3xl);
    }

    .feature h4 {
        font-size: var(--text-sm);
    }

    .feature p {
        font-size: var(--text-xs);
    }

    .perf-scores {
        grid-template-columns: 1fr 1fr 1fr;
        gap: var(--space-1);
    }

    .perf-circle {
        width: 50px;
        height: 50px;
    }

    .perf-value {
        font-size: var(--text-sm);
    }

    .perf-label {
        font-size: 10px;
    }

    .integration-diagram {
        height: 220px;
    }

    .int-node--center {
        width: 60px;
        height: 60px;
    }

    .int-node--center svg {
        width: 20px;
        height: 20px;
    }

    .int-node--center span {
        font-size: 9px;
    }

    .int-node {
        padding: var(--space-1) var(--space-2);
        font-size: 9px;
    }

    .int-node--1 { 
        top: 3%; 
    }
    .int-node--2 { 
        right: 0; 
    }
    .int-node--3 { 
        bottom: 3%; 
    }
    .int-node--4 { 
        left: 0; 
    }

    .int-line--1,
    .int-line--3 {
        height: 35px;
    }

    .int-line--1 {
        top: calc(3% + 25px);
    }

    .int-line--3 {
        bottom: calc(3% + 25px);
    }

    .int-line--2,
    .int-line--4 {
        width: 35px;
    }

    .int-line--2 {
        right: calc(0% + 50px);
    }

    .int-line--4 {
        left: calc(0% + 50px);
    }
}
