/**
 * Premium Flip Boxes - Main Styles
 * Version: 2.0.0
 */

/* ========================================
   GRID LAYOUT
   ======================================== */
.pfb-grid {
    display: grid;
    gap: 30px;
    margin: 40px 0;
}

.pfb-grid-cols-1 {
    grid-template-columns: 1fr;
}

.pfb-grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.pfb-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.pfb-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
    .pfb-grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .pfb-grid-cols-2,
    .pfb-grid-cols-3,
    .pfb-grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   FLIP BOX CONTAINER
   ======================================== */
.pfb-flip-box {
    position: relative;
    width: 100%;
    cursor: pointer;
    perspective: 1000px;
}

.pfb-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

/* ========================================
   FRONT AND BACK SIDES
   ======================================== */
.pfb-flip-front,
.pfb-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.pfb-flip-front {
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pfb-flip-back {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.pfb-flip-content {
    width: 100%;
    text-align: center;
    color: #ffffff;
    padding: 20px;
}

/* ========================================
   CONTENT ELEMENTS
   ======================================== */
.pfb-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    line-height: 1;
}

.pfb-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #ffffff;
    line-height: 1.2;
}

.pfb-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.4;
}

.pfb-description {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.pfb-button {
    display: inline-block;
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pfb-button:hover {
    background: #ffffff;
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ========================================
   EFFECT 1: CLASSIC VERTICAL FLIP
   ======================================== */
.pfb-effect-classic:hover .pfb-flip-inner {
    transform: rotateY(180deg);
}

.pfb-effect-classic .pfb-flip-back {
    transform: rotateY(180deg);
}

/* ========================================
   EFFECT 2: DIAGONAL FLIP
   ======================================== */
.pfb-effect-diagonal .pfb-flip-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.pfb-effect-diagonal .pfb-flip-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: rotateX(180deg) rotateY(180deg);
}

.pfb-effect-diagonal:hover .pfb-flip-inner {
    transform: rotateX(180deg) rotateY(180deg);
}

.pfb-effect-diagonal .pfb-flip-inner {
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   EFFECT 3: SLIDE UP OVERLAY
   ======================================== */
.pfb-effect-slide-up {
    overflow: hidden;
}

.pfb-effect-slide-up .pfb-flip-inner {
    transform-style: initial;
}

.pfb-effect-slide-up .pfb-flip-front {
    position: relative;
    backface-visibility: visible;
    transition: transform 0.5s ease;
}

.pfb-effect-slide-up .pfb-flip-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pfb-effect-slide-up:hover .pfb-flip-front {
    transform: scale(1.1);
}

.pfb-effect-slide-up .pfb-flip-back {
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    transform: translateY(100%);
    backface-visibility: visible;
    transition: transform 0.4s ease-out;
}

.pfb-effect-slide-up:hover .pfb-flip-back {
    transform: translateY(0);
}

/* Gradient overlay always visible at bottom */
.pfb-effect-slide-up .pfb-flip-front::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    z-index: 10;
}

.pfb-effect-slide-up .pfb-flip-front .pfb-flip-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 11;
}

/* ========================================
   EFFECT 4: SPLIT REVEAL
   ======================================== */
.pfb-effect-split .pfb-split-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    pointer-events: none;
}

.pfb-effect-split .pfb-split-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
    transition: transform 0.4s ease-out;
}

.pfb-effect-split .pfb-split-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(135deg, #f97316 0%, #dc2626 100%);
    transition: transform 0.4s ease-out;
}

.pfb-effect-split:hover .pfb-split-top {
    transform: translateY(-100%);
}

.pfb-effect-split:hover .pfb-split-bottom {
    transform: translateY(100%);
}

/* Front info positioned at bottom of top half */
.pfb-effect-split .pfb-flip-front .pfb-flip-content {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    text-align: left;
}

/* Back content revealed in center */
.pfb-effect-split .pfb-flip-back {
    background: transparent;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
    z-index: 1;
}

.pfb-effect-split:hover .pfb-flip-back {
    opacity: 1;
    transform: scale(1);
}

.pfb-effect-split .pfb-flip-back .pfb-flip-content {
    background: #ffffff;
    color: #000000;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    margin: 0 auto;
}

.pfb-effect-split .pfb-flip-back .pfb-title {
    color: #000000;
}

.pfb-effect-split .pfb-flip-back .pfb-description {
    color: #333333;
}

.pfb-effect-split .pfb-flip-back .pfb-button {
    background: #f97316;
    color: #ffffff;
}

.pfb-effect-split .pfb-flip-back .pfb-button:hover {
    background: #ea580c;
    color: #ffffff;
}

/* ========================================
   MOBILE OPTIMIZATION
   ======================================== */
@media (max-width: 768px) {
    /* Make flip boxes tappable on mobile */
    .pfb-flip-box.mobile-tap-enabled {
        cursor: pointer;
    }
    
    .pfb-flip-box.mobile-tap-enabled.flipped .pfb-flip-inner {
        transform: rotateY(180deg);
    }
    
    .pfb-effect-diagonal.mobile-tap-enabled.flipped .pfb-flip-inner {
        transform: rotateX(180deg) rotateY(180deg);
    }
    
    .pfb-effect-slide-up.mobile-tap-enabled.flipped .pfb-flip-back {
        transform: translateY(0);
    }
    
    .pfb-effect-slide-up.mobile-tap-enabled.flipped .pfb-flip-front {
        transform: scale(1.1);
    }
    
    .pfb-effect-split.mobile-tap-enabled.flipped .pfb-split-top {
        transform: translateY(-100%);
    }
    
    .pfb-effect-split.mobile-tap-enabled.flipped .pfb-split-bottom {
        transform: translateY(100%);
    }
    
    .pfb-effect-split.mobile-tap-enabled.flipped .pfb-flip-back {
        opacity: 1;
        transform: scale(1);
    }
    
    /* Adjust font sizes for mobile */
    .pfb-title {
        font-size: 1.4rem;
    }
    
    .pfb-icon {
        font-size: 3rem;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
.pfb-flip-box:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.pfb-flip-box:focus:not(:focus-visible) {
    outline: none;
}

/* ========================================
   LOADING STATE
   ======================================== */
.pfb-flip-box.loading {
    opacity: 0.5;
    pointer-events: none;
}

.pfb-flip-box.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: pfb-spin 0.8s linear infinite;
}

@keyframes pfb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   POPUP MODAL STYLES
   ======================================== */
body.pfb-modal-open {
    overflow: hidden;
}

.pfb-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pfb-modal-backdrop.active {
    opacity: 1;
}

.pfb-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 1200px;
    width: 90%;
    max-height: 90vh;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.pfb-modal.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.pfb-modal-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.pfb-modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 10;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pfb-modal-close:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.pfb-modal-close svg {
    color: #333333;
}

.pfb-modal-hero {
    position: relative;
    height: 320px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

.pfb-modal-image {
    position: absolute;
    bottom: 24px;
    left: 48px;
    width: 160px;
    height: 160px;
    border-radius: 16px;
    overflow: hidden;
    border: 6px solid white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    background-size: cover;
    background-position: center;
}

.pfb-modal-social {
    position: absolute;
    top: 24px;
    right: 80px;
    display: flex;
    gap: 12px;
}

.pfb-social-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pfb-social-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.pfb-social-btn svg {
    color: #ffffff;
}

.pfb-modal-body {
    padding: 48px;
}

.pfb-modal-header {
    margin-bottom: 32px;
}

.pfb-modal-name {
    font-size: 2rem;
    font-weight: 700;
    color: #000000;
    margin: 0 0 8px 0;
}

.pfb-modal-position {
    font-size: 1.25rem;
    color: #764ba2;
    margin: 0;
}

.pfb-modal-contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.pfb-contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e9e4f7 100%);
    border-radius: 12px;
    border: 1px solid #e0d9f3;
}

.pfb-contact-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pfb-contact-icon svg {
    color: #ffffff;
}

.pfb-contact-info {
    flex: 1;
    min-width: 0;
}

.pfb-contact-label {
    font-size: 0.875rem;
    color: #666666;
    margin: 0 0 4px 0;
}

.pfb-contact-value {
    font-size: 1rem;
    color: #000000;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pfb-modal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.pfb-stat-card {
    padding: 24px;
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    transition: border-color 0.2s ease;
}

.pfb-stat-card:hover {
    border-color: #764ba2;
}

.pfb-stat-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
}

.pfb-stat-icon svg {
    color: #764ba2;
}

.pfb-stat-label {
    font-size: 0.875rem;
    color: #666666;
    margin: 0 0 8px 0;
}

.pfb-stat-value {
    font-size: 1.125rem;
    color: #000000;
    font-weight: 600;
    margin: 0;
}

.pfb-modal-section {
    margin-bottom: 40px;
}

.pfb-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.pfb-title-bar {
    width: 6px;
    height: 32px;
    background: linear-gradient(to bottom, #764ba2 0%, #f97316 100%);
    border-radius: 3px;
}

.pfb-bio-content p {
    font-size: 1rem;
    color: #333333;
    line-height: 1.75;
    margin: 0 0 20px 0;
}

.pfb-bio-content p:last-child {
    margin-bottom: 0;
}

.pfb-achievements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.pfb-achievement-card {
    padding: 20px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.2s ease;
}

.pfb-achievement-card:hover {
    border-color: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.pfb-achievement-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #764ba2 0%, #f97316 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.pfb-achievement-icon svg {
    color: #ffffff;
}

.pfb-achievement-card p {
    font-size: 0.95rem;
    color: #333333;
    line-height: 1.6;
    margin: 0;
}

.pfb-modal-actions {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.pfb-btn {
    flex: 1;
    min-width: 200px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.pfb-btn-primary {
    background: linear-gradient(135deg, #764ba2 0%, #f97316 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.pfb-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
}

.pfb-btn-secondary {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    color: #000000;
}

.pfb-btn-secondary:hover {
    border-color: #764ba2;
    background: #f9f9f9;
}

.pfb-btn svg {
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pfb-modal {
        width: 95%;
    }
    
    .pfb-modal-body {
        padding: 24px;
    }
    
    .pfb-modal-hero {
        height: 250px;
    }
    
    .pfb-modal-image {
        width: 120px;
        height: 120px;
        left: 24px;
        bottom: 16px;
    }
    
    .pfb-modal-social {
        right: 24px;
        top: 16px;
    }
    
    .pfb-social-btn {
        width: 40px;
        height: 40px;
    }
    
    .pfb-modal-name {
        font-size: 1.5rem;
    }
    
    .pfb-modal-position {
        font-size: 1rem;
    }
    
    .pfb-modal-contact,
    .pfb-modal-stats,
    .pfb-achievements {
        grid-template-columns: 1fr;
    }
    
    .pfb-modal-actions {
        flex-direction: column;
    }
    
    .pfb-btn {
        width: 100%;
        min-width: 100%;
    }
}
