/* ==========================================================================
   Codex Solutions — Recent Projects Section & Video Showcase Styles
   ========================================================================== */

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(138, 216, 199, 0.12);
    border: 1px solid rgba(138, 216, 199, 0.32);
    color: var(--primary-2);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

html[data-theme="light"] .section-badge {
    background: rgba(30, 115, 100, 0.1);
    border-color: rgba(30, 115, 100, 0.28);
    color: #166555;
}

/* Projects Showcase Grid */
.projects-grid {
    display: flex;
    flex-direction: column;
    gap: 48px;
    margin-top: 36px;
}

.project-card {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 32px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(141, 167, 232, 0.4);
    box-shadow: 0 28px 65px rgba(0, 0, 0, 0.38);
}

html[data-theme="light"] .project-card:hover {
    border-color: rgba(60, 100, 170, 0.35);
    box-shadow: 0 24px 50px rgba(20, 40, 70, 0.12);
}

/* Reverse layout for alternating rhythm */
.project-card:nth-child(even) {
    grid-template-columns: 0.85fr 1.15fr;
}

.project-card:nth-child(even) .project-media-wrap {
    order: 2;
}

.project-card:nth-child(even) .project-content {
    order: 1;
}

/* Video & Window Wrapper */
.project-media-wrap {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: #0d121d;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

html[data-theme="light"] .project-media-wrap {
    background: #1a2232;
    border-color: rgba(0, 0, 0, 0.12);
}

.project-window-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #141b2a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.78rem;
}

.window-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.window-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.window-url {
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.74rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.window-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #4ade80;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

/* Video Container & HTML5 Video */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.project-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.4s ease;
}

.project-card:hover .project-video {
    transform: scale(1.015);
}

/* Video Overlay Controls */
.video-controls-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 40%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.video-container:hover .video-controls-overlay,
.video-container:focus-within .video-controls-overlay {
    opacity: 1;
    pointer-events: auto;
}

.video-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-ctrl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.video-ctrl-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    transform: translateY(-1px);
}

/* Project Content Area */
.project-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8px 4px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.project-tag {
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(141, 167, 232, 0.1);
    border: 1px solid rgba(141, 167, 232, 0.24);
    color: var(--primary);
    font-size: 0.74rem;
    font-weight: 650;
    letter-spacing: 0.02em;
}

.project-tag.tag-ai {
    background: rgba(138, 216, 199, 0.14);
    border-color: rgba(138, 216, 199, 0.36);
    color: var(--primary-2);
}

.project-title {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 12px;
    color: var(--text);
}

.project-desc {
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.6;
    margin: 0 0 20px;
}

/* Metrics & Highlights Grid */
.project-highlights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    margin-bottom: 24px;
}

.highlight-item {
    display: flex;
    flex-direction: column;
}

.highlight-val {
    font-size: 1.22rem;
    font-weight: 800;
    color: var(--primary-2);
    line-height: 1.2;
}

html[data-theme="light"] .highlight-val {
    color: #0f766e;
}

.highlight-lbl {
    font-size: 0.74rem;
    color: var(--muted);
    font-weight: 500;
    margin-top: 3px;
}

/* Project Actions */
.project-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.btn-project-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1.35rem;
    border-radius: 10px;
    background: linear-gradient(120deg, #9adccf, #9eb1e8);
    color: #08131c;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(124, 156, 255, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-project-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(124, 156, 255, 0.35);
}

.btn-project-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-weight: 650;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-project-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}

html[data-theme="light"] .btn-project-outline {
    background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .btn-project-outline:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Lightbox Modal for Fullscreen Video */
.video-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.video-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.video-modal-dialog {
    position: relative;
    width: min(1040px, 100%);
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 35px 80px rgba(0, 0, 0, 0.7);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.video-modal-backdrop.is-open .video-modal-dialog {
    transform: scale(1);
}

.video-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.video-modal-title {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
}

.video-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    font-size: 1.3rem;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.video-modal-close:hover {
    background: rgba(239, 68, 68, 0.8);
}

.video-modal-player-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.video-modal-player-wrap video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #141f33;
}

.video-modal-footer p {
    color: #94a3b8;
    font-size: 0.86rem;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 960px) {
    .project-card,
    .project-card:nth-child(even) {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .project-card:nth-child(even) .project-media-wrap {
        order: 1;
    }

    .project-card:nth-child(even) .project-content {
        order: 2;
    }

    .project-highlights {
        grid-template-columns: repeat(3, 1fr);
        padding: 12px;
    }
}

@media (max-width: 600px) {
    .project-highlights {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .project-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-project-primary,
    .btn-project-outline {
        justify-content: center;
    }
}


/* View switcher buttons in window bar */
.window-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 650;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    transition: all 0.2s ease;
}

.view-switch-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.view-switch-btn.is-active {
    background: var(--primary-2);
    color: #08131c;
    border-color: transparent;
    font-weight: 700;
}

html[data-theme="light"] .view-switch-btn {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

html[data-theme="light"] .view-switch-btn.is-active {
    background: #0f766e;
    color: #ffffff;
}

/* Live Iframe View inside project card */
.project-live-frame {
    display: none;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.video-container.show-live .project-video,
.video-container.show-live .video-controls-overlay {
    display: none !important;
}

.video-container.show-live .project-live-frame {
    display: block !important;
}


/* Powered by Codex Solutions Badge */
.powered-by-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(141, 167, 232, 0.14), rgba(138, 216, 199, 0.16));
    border: 1px solid rgba(138, 216, 199, 0.35);
    color: var(--primary-2);
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.03em;
    margin-bottom: 14px;
    align-self: flex-start;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.powered-by-tag:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
}

.powered-by-tag .powered-by-icon {
    font-size: 0.9rem;
    color: var(--primary);
    line-height: 1;
}

.powered-by-tag strong {
    color: var(--text);
    font-weight: 800;
}

html[data-theme="light"] .powered-by-tag {
    background: linear-gradient(135deg, rgba(30, 115, 100, 0.1), rgba(60, 100, 170, 0.1));
    border-color: rgba(30, 115, 100, 0.32);
    color: #0f766e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .powered-by-tag strong {
    color: #08131c;
}
