/**
 * TechStack Widget Styles
 * Fully responsive grid with hover popups
 */

/* ==========================================
   Main Container & Typography
   ========================================== */

.techstack-widget {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Elementor Editor Compatibility */
.elementor-widget-highpass-techstack .techstack-widget {
    min-height: 300px;
}

/* Header Section - Always on Top */
.techstack-header {
    width: 100%;
    margin-bottom: 40px;
}

.techstack-main-title {
    text-align: center;
    margin-bottom: 15px;
}

.techstack-main-title h1,
.techstack-main-title h2,
.techstack-main-title h3,
.techstack-main-title p {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    color: #0066cc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.techstack-main-description {
    text-align: center;
    margin-bottom: 40px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.techstack-main-description p {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin: 0;
}

/* ==========================================
   Layout Variations
   ========================================== */

/* Sections Wrapper */
.techstack-sections-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    width: 100%;
}

/* Grid Layout - sections (Front-end, Back-end, etc.) sit side by side on
   wider screens, matching the original design, and stack on narrow ones. */
.techstack-grid .techstack-sections-wrapper {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* Stacked Layout */
.techstack-stacked .techstack-sections-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ==========================================
   Sections
   ========================================== */

.techstack-section {
    padding: 30px;
    border-radius: 8px;
    background: #f9f9f9;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.techstack-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.techstack-section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Items Grid
   ========================================== */

.techstack-items-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 20px;
}

/* Ensure minimum visibility in Elementor editor */
.elementor-editor-active .techstack-items-grid {
    min-height: 100px;
}

/* ==========================================
   Individual Items
   ========================================== */

.techstack-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 84px;
    min-height: 76px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: visible;
    padding: 10px 6px;
}

.techstack-item:hover {
    border-color: #0066cc;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
    background: #f0f5ff;
    transform: translateY(-2px);
}

.techstack-item.has-popup:hover {
    z-index: 100;
}

.techstack-item-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 8px;
}

.techstack-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 30px;
}

.techstack-item-icon i {
    font-size: 28px;
    color: #1e293b;
}

.techstack-icon-image {
    max-width: 32px;
    max-height: 32px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.techstack-item-name {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    padding: 4px;
}

.techstack-item-name span {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    line-height: 1.25;
    word-break: break-word;
}

.techstack-item-label {
    width: 100%;
    text-align: center;
    padding-top: 6px;
}

.techstack-item-label span {
    font-size: 10.5px;
    font-weight: 500;
    color: #666;
    line-height: 1.2;
}

/* ==========================================
   Popup Styles
   ========================================== */

.techstack-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    width: 280px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1000;
    margin-bottom: 15px;
}

.techstack-item.has-popup:hover .techstack-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Popup arrow/pointer */
.techstack-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

/* ==========================================
   Popup Content
   ========================================== */

.techstack-popup-columns {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.techstack-popup-column {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.techstack-column-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    margin: 0;
}

.techstack-column-value {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.techstack-column-value i {
    font-size: 12px;
    color: #0066cc;
}

.techstack-popup-separator {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 5px 0;
}

.techstack-popup-description {
    margin-bottom: 15px;
    padding: 0;
}

.techstack-popup-description p {
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    margin: 0;
}

/* ==========================================
   Popup Button
   ========================================== */

.techstack-popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 15px;
    background: #0066cc;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.techstack-popup-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
}

.techstack-popup-btn i {
    font-size: 12px;
}

/* ==========================================
   Responsive Design
   ========================================== */

/* Tablets (768px and down) */
@media (max-width: 768px) {
    .techstack-sections-wrapper {
        grid-template-columns: 1fr !important;
    }

    .techstack-section {
        padding: 20px;
    }

    .techstack-section-title {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .techstack-items-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }

    .techstack-main-title h1,
    .techstack-main-title h2,
    .techstack-main-title h3,
    .techstack-main-title p {
        font-size: 22px;
    }

    .techstack-popup {
        width: 250px;
    }
}

/* Mobile (480px and down) */
@media (max-width: 480px) {
    .techstack-header {
        margin-bottom: 25px;
    }

    .techstack-sections-wrapper {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .techstack-section {
        padding: 15px;
    }

    .techstack-section-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .techstack-items-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    .techstack-item {
        aspect-ratio: auto;
        min-height: 70px;
    }

    .techstack-main-title h1,
    .techstack-main-title h2,
    .techstack-main-title h3,
    .techstack-main-title p {
        font-size: 18px;
    }

    .techstack-main-description p {
        font-size: 14px;
    }

    .techstack-popup {
        width: 220px;
        font-size: 12px;
    }

    .techstack-popup-btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .techstack-popup-description p {
        font-size: 12px;
    }
}

/* Small Mobile (320px and up) */
@media (max-width: 320px) {
    .techstack-items-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .techstack-popup {
        width: 200px;
        left: auto;
        right: 0;
        transform: translateX(0) translateY(-10px);
    }

    .techstack-item.has-popup:hover .techstack-popup {
        transform: translateX(0) translateY(0);
    }

    .techstack-popup::after {
        right: 20px;
        left: auto;
        transform: translateX(0);
    }
}

/* ==========================================
   Light & Dark Mode Support
   ========================================== */

@media (prefers-color-scheme: dark) {
    .techstack-section {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .techstack-section:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

    .techstack-section-title {
        border-bottom-color: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    .techstack-item {
        background: #2a2a2a;
        border-color: transparent;
    }

    .techstack-item:hover {
        background: #333;
        border-color: #0066cc;
    }

    .techstack-popup {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .techstack-popup::after {
        border-top-color: #2a2a2a;
    }

    .techstack-column-title {
        color: #aaa;
    }

    .techstack-popup-description p {
        color: #ccc;
    }

    .techstack-popup-separator {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ==========================================
   Accessibility
   ========================================== */

.techstack-item:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

.techstack-popup-btn:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
    .techstack-popup {
        display: none;
    }

    .techstack-item {
        page-break-inside: avoid;
    }
}

/* ==========================================
   Animation Enhancements
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .techstack-item,
    .techstack-section,
    .techstack-popup,
    .techstack-popup-btn {
        transition: none;
    }
}

/* ==========================================
   Utility Classes
   ========================================== */

.techstack-widget-wrapper {
    width: 100%;
}

.techstack-widget-wrapper.qodef-section {
    padding: 40px 0;
}

.techstack-widget-wrapper.qodef-section.z-index-6 {
    position: relative;
    z-index: 6;
}

/* ==========================================
   Admin Styles
   ========================================== */

.techstack-section-form,
.techstack-item-form {
    border-radius: 4px;
}

.techstack-section-form {
    border: 1px solid #ddd;
}

.techstack-add-section,
.techstack-add-item {
    width: 100%;
    padding: 10px;
}
