/**
 * Alumex Services CPT Styles
 * Preserves exact styling from HTML and ensures responsive design
 */

/* Main Service Wrapper */
.ae-service-wrapper {
    margin-bottom: 60px;
    padding: 20px 0;
}

.ae-service-wrapper:last-child {
    margin-bottom: 0;
}

/* Page Title */
.ae-service-wrapper h1.wp-block-heading {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 30px;
    color: #333;
}

/* Title Section - Two Column Layout: text and GIF aligned at top */
.ae-title-section {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    align-items: flex-start;
}

.ae-title-section .wp-block-column {
    flex: 1;
    align-self: flex-start;
}

.ae-title-section .wp-block-column:first-child {
    padding-top: 0;
}

.ae-title-section .wp-block-column:last-child {
    padding-top: 0;
}

/* Title Block - Project Info */
.ae-title-block {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
}

.ae-title-block-inner {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    align-items: start;
}

.ae-title-label {
    font-weight: 600;
    color: #646464;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ae-title-value {
    color: #646464;
    font-size: 0.95em;
    line-height: 2;
}

.ae-title-value p {
    margin: 0 0 0.75em 0;
}

.ae-title-value p:last-child {
    margin-bottom: 0;
}

/* Title Animation Panel - top-aligned with Product Info */
.ae-title-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
    padding-top: 0;
    margin-top: 0;
}

.ae-title-animation .ae-title-image,
.ae-title-animation .ae-title-video {
    margin-top: 0;
}

.ae-title-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
}

.ae-title-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Video Section */
.ae-title-video {
    position: relative;
    width: 208px;
    max-width: 208px;
    height: auto;
    max-height: 370px;
    margin: 0 auto;
    display: block;
}

.ae-title-video video {
    width: 100%;
    height: auto;
    max-height: 370px;
    display: block;
    border-radius: 4px;
    cursor: pointer;
}

/* Video Switch Buttons */
.ae-video-switch-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.ae-video-switch-btn {
    margin: 0;
}

.ae-video-switch-btn.active .wp-block-button__link {
    background-color: #ec1c24;
    color: #fff;
}

.ae-video-switch-btn .wp-block-button__link {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ae-video-switch-btn .wp-block-button__link:hover {
    background-color: #e0e0e0;
}

/* Video Play Button */
.ae-video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.ae-video-play-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.ae-video-play-btn svg {
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.ae-video-play-btn:hover svg circle {
    fill: rgba(236, 28, 36, 1);
}

/* Technical Detail Heading */
.ae-service-wrapper h3.wp-block-heading {
    font-size: 1.8em;
    font-weight: 600;
    margin: 40px 0 20px;
    color: #333;
    border-bottom: 2px solid #ec1c24;
    padding-bottom: 10px;
}

/* Technical Wrapper */
.ae-technical-wrapper {
    margin-top: 30px;
}

.ae-technical-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.ae-technical-text {
    flex: 1;
}

/* Two-column text layout (spec tables, no PDF/image) */
.ae-technical-layout .ae-technical-text-right {
    flex: 1;
}

.ae-technical-layout .ae-technical-text-right h5.wp-block-heading,
.ae-technical-layout .ae-technical-text-right h6.wp-block-heading {
    margin-top: 25px;
}

.ae-technical-layout .ae-technical-text-right h5.wp-block-heading:first-child,
.ae-technical-layout .ae-technical-text-right h6.wp-block-heading:first-child {
    margin-top: 0;
}

/* Full width when no PDF/image - technical detail takes both sides */
.ae-technical-full-width {
    display: block !important;
}

.ae-technical-full-width .ae-technical-text {
    flex: none;
    width: 100%;
}

.ae-technical-download {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ae-technical-sketches {
    flex: 1;
}

/* Technical Text Sections */
.ae-technical-text h5.wp-block-heading {
    font-size: 1.2em;
    font-weight: 600;
    margin: 25px 0 10px;
    color: #1e2831;
}

.ae-technical-text h5.wp-block-heading:first-child {
    margin-top: 0;
}

.ae-technical-text h6.wp-block-heading {
    font-size: 1em;
    font-weight: 600;
    margin: 15px 0 8px;
    color: #1e2831;
}

.ae-technical-text ul {
    margin: 5px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.ae-technical-text ul li {
    margin-bottom: 5px;
    line-height: 1.8;
    color: #646464;
    font-size: 13px;
}

.ae-technical-text p {
    margin: 10px 0 20px;
    line-height: 1.8;
    color: #646464;
    font-size: 13px;
}

/* Ensure two-column and full-width technical text match (no PDF/image) */
.ae-technical-text-right ul li,
.ae-technical-full-width .ae-technical-text ul li {
    font-size: 13px;
}

.ae-technical-text-right p,
.ae-technical-full-width .ae-technical-text p {
    font-size: 13px;
}

/* Info Block - Expandable Details */
.ae-info-block {
    margin: 20px 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.ae-info-details {
    border: none;
}

.ae-info-summary {
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.ae-info-summary:hover {
    background: #e9ecef;
}

.ae-info-summary::-webkit-details-marker {
    display: none;
}

.ae-info-summary::marker {
    display: none;
}

.ae-info-learn {
    font-weight: normal;
    font-size: 0.9em;
    color: #ec1c24;
    text-decoration: underline;
}

.ae-info-content {
    padding: 20px;
    background: #fff;
}

.ae-info-content p {
    margin-bottom: 15px;
}

.ae-info-content ul {
    margin-top: 10px;
}

/* Technical Sheet Image */
.ae-technical-sheet {
    width: 100%;
    margin: 0;
}

.ae-technical-sheet img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ae-technical-sheet img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ae-technical-sheet a {
    display: block;
}

/* PDF Download Button */
.ae-pdf-button-wrap {
    margin-top: 20px;
}

.ae-pdf-button .wp-block-button__link {
    background-color: #ec1c24;
    color: #fff;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
}

.ae-pdf-button .wp-block-button__link:hover {
    background-color: #c4161d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(236, 28, 36, 0.3);
}

/* Spec Tables */
.ae-spec-table {
    margin-bottom: 30px;
}

.ae-spec-heading {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ae-spec-table table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
}

.ae-spec-table thead {
    background-color: #f8f9fa;
}

.ae-spec-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ae-spec-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    color: #555;
    font-size: 0.95em;
}

.ae-spec-table tbody tr:hover {
    background-color: #f8f9fa;
}

.ae-spec-table td.code {
    font-weight: 600;
    color: #333;
    font-family: 'Courier New', monospace;
}

.ae-spec-table td.size {
    color: #666;
}

.ae-spec-table td.item {
    text-transform: lowercase;
    font-style: italic;
}

.ae-spec-table-3col {
    width: 100%;
}

.ae-spec-spacer {
    height: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ae-title-section {
        flex-direction: column;
        gap: 20px;
    }
    
    .ae-title-section .wp-block-column {
        width: 100%;
    }
    
    .ae-title-animation {
        min-height: auto;
    }
    
    .ae-title-video {
        width: 100%;
        max-width: 100%;
    }
    
    .ae-title-video video {
        width: 100%;
        max-width: 100%;
    }
    
    .ae-technical-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .ae-technical-text,
    .ae-technical-download,
    .ae-technical-sketches {
        width: 100%;
    }
    
    .ae-service-wrapper h1.wp-block-heading {
        font-size: 2em;
    }
    
    .ae-service-wrapper h3.wp-block-heading {
        font-size: 1.5em;
    }
    
    .ae-video-switch-buttons {
        flex-wrap: wrap;
    }
    
    .ae-spec-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ae-spec-table table {
        min-width: 500px;
    }
}

@media (max-width: 480px) {
    .ae-service-wrapper {
        padding: 15px 0;
    }
    
    .ae-service-wrapper h1.wp-block-heading {
        font-size: 1.75em;
        margin-bottom: 20px;
    }
    
    .ae-title-block {
        padding: 15px;
    }
    
    .ae-title-block-inner {
        gap: 8px 15px;
    }
    
    .ae-title-label,
    .ae-title-value {
        font-size: 0.9em;
    }
    
    .ae-technical-text h5.wp-block-heading {
        font-size: 1.1em;
    }
    
    .ae-pdf-button .wp-block-button__link {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
        text-align: center;
    }
    
    .ae-spec-table table {
        min-width: 400px;
        font-size: 0.9em;
    }
    
    .ae-spec-table th,
    .ae-spec-table td {
        padding: 8px 10px;
    }
}

/* Print Styles */
@media print {
    .ae-video-switch-buttons,
    .ae-video-play-btn,
    .ae-pdf-button-wrap {
        display: none;
    }
    
    .ae-service-wrapper {
        page-break-inside: avoid;
        margin-bottom: 30px;
    }
    
    .ae-title-section,
    .ae-technical-layout {
        display: block;
    }
}
