/**
 * Presentation Cards - Combined Editor and Frontend Styles
 */

/* ========================================
   EDITOR STYLES
   ======================================== */

.presentation-cards-editor-preview {
    padding: 30px;
    background: #f8f9fa;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    min-height: 300px;
}

.presentation-cards-editor-preview .preview-header {
    text-align: center;
    margin-bottom: 30px;
}

.presentation-cards-editor-preview .preview-header .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #3498db;
}

.presentation-cards-editor-preview .preview-header h3 {
    margin: 10px 0 0 0;
    font-size: 24px;
    color: #2c3e50;
}

.presentation-cards-editor-preview .preview-settings {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.presentation-cards-editor-preview .preview-settings p {
    margin: 10px 0;
    color: #495057;
    font-size: 14px;
}

.presentation-cards-editor-preview .preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.presentation-cards-editor-preview .preview-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.presentation-cards-editor-preview .preview-card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 20px;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.presentation-cards-editor-preview .preview-card-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

.presentation-cards-editor-preview .preview-note {
    text-align: center;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.presentation-cards-editor-preview .preview-note p {
    margin: 0;
    color: #1565c0;
    font-size: 14px;
}

/* ========================================
   FRONTEND STYLES
   ======================================== */

/* Main Wrapper */
.presentation-cards-wrapper {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Grid Layout */
.presentation-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    perspective: 1000px;
}

/* Dynamic columns based on attribute */
.presentation-cards-wrapper[data-cards-per-row="1"] .presentation-cards-grid {
    grid-template-columns: repeat(1, 1fr);
}

.presentation-cards-wrapper[data-cards-per-row="2"] .presentation-cards-grid {
    grid-template-columns: repeat(2, 1fr);
}

.presentation-cards-wrapper[data-cards-per-row="3"] .presentation-cards-grid {
    grid-template-columns: repeat(3, 1fr);
}

.presentation-cards-wrapper[data-cards-per-row="4"] .presentation-cards-grid {
    grid-template-columns: repeat(4, 1fr);
}

.presentation-cards-wrapper[data-cards-per-row="5"] .presentation-cards-grid {
    grid-template-columns: repeat(5, 1fr);
}

.presentation-cards-wrapper[data-cards-per-row="6"] .presentation-cards-grid {
    grid-template-columns: repeat(6, 1fr);
}

/* Card Container */
.presentation-card {
    position: relative;
    width: 100%;
    height: 400px;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius:12px;
}

.presentation-card:not(.card-locked):hover {
    transform: scale(1.05);
}

/* Locked Card - Not yet available */
.presentation-card.card-locked {
    cursor: not-allowed;
    opacity: 0.7;
}

.presentation-card.card-locked:hover {
    transform: scale(1);
}

/* Prevent locked cards from being flipped */
.presentation-card.card-locked .card-back {
    display: none;
}

/* Today's Card Highlight */
.presentation-card.card-today {
    animation: highlight-pulse 2s ease-in-out 3;
}

@keyframes highlight-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(52, 152, 219, 0);
    }
}

/* Card Inner - 3D Container */
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.presentation-card.is-flipped .card-inner {
    transform: rotateY(180deg);
}

/* Card Faces */
.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Card Front */
.card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.card-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    word-wrap: break-word;
    color: #ffffff;
}

.card-date {
    margin-top: 20px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* Card Back */
.card-back {
    background: white;
    transform: rotateY(180deg);
    overflow-y: auto;
}

.card-content {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
        display: grid;
    align-items: center;
}

/* Card Image */
.card-image {
    margin-bottom: 20px;
}

.card-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Card Video */
.card-video {
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.card-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Card Text */
.card-text {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
}

.card-text p {
    margin-bottom: 15px;
}

.card-text p:last-child {
    margin-bottom: 0;
}

/* Locked Card Shake Animation */
.card-shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Locked Card Message */
.card-locked-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.card-locked-message.show {
    opacity: 1;
}

/* Pulse Animation for Today's Card */
.card-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

/* Empty State */
.presentation-cards-empty {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.presentation-cards-empty p {
    font-size: 18px;
    color: #6c757d;
    margin: 0;
}

/* Keyboard Focus Styles */
.presentation-card:focus {
    /* outline: 3px solid #3498db; */
    outline-offset: 3px;
}

.presentation-card.card-locked:focus {
    outline: 3px solid #e74c3c;
    /* box-shadow: 0 0 0 2pt red; */
    border-radius:12px;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Tablets */
@media screen and (max-width: 1024px) {
    .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="5"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="6"] .presentation-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .presentation-cards-wrapper[data-cards-per-row="4"] .presentation-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .presentation-card {
        height: 350px;
    }

    .card-title {
        font-size: 24px;
    }

    .presentation-cards-editor-preview .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Landscape */
@media screen and (max-width: 768px) {
    .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="3"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="4"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="5"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="6"] .presentation-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .presentation-card {
        height: 300px;
    }

    .card-title {
        font-size: 20px;
    }

    .card-date {
        font-size: 12px;
        padding: 6px 12px;
    }

    .card-text {
        font-size: 14px;
    }

    .presentation-cards-editor-preview {
        padding: 20px;
    }

    .presentation-cards-editor-preview .preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Mobile Portrait */
@media screen and (max-width: 480px) {
    .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="2"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="3"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="4"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="5"] .presentation-cards-grid,
    .presentation-cards-wrapper[data-cards-per-row="6"] .presentation-cards-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 20px;
    }

    .presentation-card {
        height: 350px;
    }

    .card-title {
        font-size: 22px;
    }

    .card-front {
        padding: 20px;
    }

    .card-content {
        padding: 15px;
    }

    .presentation-cards-editor-preview .preview-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    .presentation-cards-editor-preview .preview-card-front {
        min-height: 120px;
        padding: 30px 15px;
    }
}

/* Print Styles */
@media print {
    .presentation-card {
        page-break-inside: avoid;
        height: auto;
    }

    .card-inner {
        transform: none !important;
    }

    .card-back {
        transform: none !important;
        position: relative;
        margin-top: 20px;
    }

    .card-locked .card-inner {
        transform: none !important;
    }
}
