/* Services Pillars Section */
.pillars-section {
    padding: 6rem 0;
    background: var(--bg-body);
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 4rem;
}

.pillars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

/* Pillar Card (Base) */
.pillar-card {
    background: var(--bg-surface);
    border-radius: 1rem;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    height: 100%;
    /* Ensure full height for grid */
}

.pillar-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.pillar-number {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
    opacity: 0.05;
    position: absolute;
    top: 1rem;
    right: 2rem;
    line-height: 1;
}

.pillar-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    position: relative;
    z-index: 1;
}

.pillar-card>p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.pillar-services-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 1;
}

.pillar-services-list li {
    padding: 0.8rem 0;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 3.5rem;
    /* Ensure consistent height */
}

.pillar-services-list li:last-child {
    border-bottom: none;
}

/* Enhanced Priority Badge */
.priority-badge {
    display: inline-block;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
    vertical-align: middle;
}

.priority-badge::before {
    content: '★';
    /* color: #FFD700; */
}

.pillar-gain {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
}

/* Improved Flip Card Styles */
.service-flip-container {
    perspective: 1000px;
    cursor: pointer;
    position: relative;
    padding: 0 !important;
    /* Remove padding from li to let children handle it */
    border-bottom: 1px solid var(--border-color);
}

.service-flip-container:last-child {
    border-bottom: none;
}

.service-flip-inner {
    position: relative;
    width: 100%;
    min-height: 4rem;
    /* Fixed height for the flip area */
    text-align: left;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.service-flip-container:hover .service-flip-inner {
    transform: rotateX(180deg);
    /* Rotate X for a vertical flip which might be cleaner, or stick to Y */
}

/* Let's stick to Y but ensure backgrounds are solid */
.service-flip-container:hover .service-flip-inner {
    transform: rotateY(180deg);
}

.service-flip-front,
.service-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    background: var(--bg-surface);
    /* Ensure solid background */
    top: 0;
    left: 0;
}

.service-flip-front {
    z-index: 2;
}

.service-flip-back {
    transform: rotateY(180deg);
    z-index: 1;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border-radius: 0.5rem;
    border: 1px solid var(--primary);
    /* Highlight border when flipped */
    box-shadow: var(--shadow-md);
    /* Ensure content doesn't overflow */
    overflow: hidden;
}

.service-flip-back p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex: 1;
    padding-right: 0.5rem;
    line-height: 1.3;

    /* Line Clamp (Standard + WebKit Fallback) */
    line-clamp: 2;
    /* Standard */
    -webkit-line-clamp: 2;
    /* WebKit */
    display: -webkit-box;
    -webkit-box-orient: vertical;

    overflow: hidden;
}

.btn-view-details {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 0.3rem;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.3s;
    font-weight: 500;
    text-decoration: none;
}

.btn-view-details:hover {
    background: var(--accent);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-body);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 1rem;
    position: relative;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-body);
    z-index: 10;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-body {
    padding: 2rem;
    color: var(--text-main);
}

/* Dark Mode Overrides */
[data-theme="dark"] .pillar-card {
    background: var(--bg-surface);
}

[data-theme="dark"] .service-flip-back {
    background: var(--bg-surface);
    border-color: var(--accent);
}

[data-theme="dark"] .modal-content {
    background: var(--bg-surface);
}

[data-theme="dark"] .modal-header {
    background: var(--bg-surface);
}