/* ==================== ESSENCE MODERN DESIGN ==================== */

.essence-engine-title {
    text-align: center;
    margin: 0px auto 0px;
}

.essence-engine-title img {
    max-width: 555px;
    width: 100%;
    height: auto;
}

.essence {
    max-width: 900px;
    width: 90%;
    margin: 40px auto;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
   
}

.essence h1 {
    font-size: 1.8rem;
    color: white;
    text-align: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px 30px;
    margin: 25px auto;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.2);
    font-weight: 600;
}

.essence button {
    padding: 12px 30px;
    margin: 15px auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid transparent;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    max-width: 333px;
}

.essence button:hover {
    background: transparent;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.essence button:active {
    transform: translateY(0);
}

/* Boutons spéciaux */
.essence button.btn-success,
.essence button[style*="green"] {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.essence button.btn-success:hover,
.essence button[style*="green"]:hover {
    background: transparent !important;
    border-color: #10b981 !important;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.essence button.btn-danger,
.essence button[style*="red"] {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.essence button.btn-danger:hover,
.essence button[style*="red"]:hover {
    background: transparent !important;
    border-color: #ef4444 !important;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.essence input[type="text"],
.essence input[type="file"] {
    width: 100%;
    max-width: 400px;
    padding: 12px 20px;
    margin: 10px auto;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.essence input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    background: rgba(255, 255, 255, 0.08);
}

.essence input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.essence select {
    padding: 12px 20px;
    margin: 10px auto;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.essence select.select-white {
    background: white;
    color: black;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000000' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.essence select:hover {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.essence select option {
    background: #1a1a2e;
    color: white;
}

.essence select.select-white option {
    background: white;
    color: black;
}

.essence-engine {
    text-align: center;
    padding: 20px;
    font-family: 'Times New Roman', Times, serif;
}

.essence-engine h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.essence-engine .deck-title {
    font-size: 1.5rem;
    color: white;
    font-weight: 500;
}

.essence-engine .deck-author {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
}

.essence-engine img {
    width: 150px;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s ease;
}

.essence-engine img:hover {
    transform: scale(1.0);
}

.toggle-deck-btn {
    margin: 20px auto;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid transparent;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-deck-btn:hover {
    background: transparent;
    border-color: #667eea;
    transform: scale(1.05);
}

.all-images-hidden {
    display: none;
}

.all-images-visible {
    display: block;
    margin-top: 20px;
    animation: fadeIn 0.5s ease;
}

.all-images-visible h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== MESSAGE BOX ==================== */

.message-box {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px auto;
    color: white;
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 600px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

/* ==================== DECK GRID (decks.php) ==================== */

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    justify-content: center;
    margin: 30px auto;
    max-width: 1200px;
    padding: 0 20px;
}

.deck-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.deck-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.deck-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
}

.deck-card:hover::before {
    opacity: 1;
}

.deck-card img {
    width: 100px;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.deck-card:hover img {
    transform: scale(1.1) rotate(5deg);
}

.deck-info {
    padding: 10px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.deck-info h3 {
    margin: 5px 0;
    font-size: 1.2rem;
    color: white;
    font-weight: 600;
}

.deck-info p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

.like-btn {
    cursor: pointer;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #f39c12;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.like-btn:hover {
    background: rgba(243, 156, 18, 0.1);
    border-color: #f39c12;
    transform: scale(1.05);
}

.like-btn.liked {
    background: rgba(243, 156, 18, 0.2);
    border-color: #f39c12;
}

/* ==================== DROP AREA (mydeck.php) ==================== */

#dropArea {
    border: 2px dashed rgba(102, 126, 234, 0.5);
    border-radius: 15px;
    padding: 40px 20px;
    text-align: center;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
}

#dropArea:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.2);
}

#dropArea.dragover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    box-shadow: 0 0 40px rgba(102, 126, 234, 0.4);
    transform: scale(1.02);
}

/* ==================== PREVIEW IMAGES ==================== */

.preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin: 20px auto;
}

.preview div {
    position: relative;
    text-align: center;
}

.preview img {
    width: 100px;
    height: auto;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.preview img:hover {
    transform: scale(1.1);
    border-color: #667eea;
}

.preview span {
    width: 25px;
    height: 25px;
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
}

.preview span:hover {
    transform: scale(1.0);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.6);
}

.delete-image-btn {
    width: 25px;
    height: 25px;
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    padding: 0;
    line-height: 1;
}

.delete-image-btn:hover {
    transform: scale(1.2);
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.6);
}

/* ==================== CARD FLIP ANIMATION (view_deck.php) ==================== */

.card {
    width: 150px;
    height: 250px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s;
    cursor: pointer;
    border-radius: 15px;
}

.card.flip {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    background-color: #1a1a2e;
}

/* État reversed - carte retournée à 180° */
.card-front img.reversed {
    transform: rotate(180deg);
}

.card-front img,
.card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    transition: none;
}

.card-back {
    transform: rotateY(180deg);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.random-image-section {
    width: 150px;
    height: 250px;
    perspective: 1000px;
    margin: 20px auto;
    position: relative;
}

/* ==================== LOADER ==================== */

.loader {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loader pour upload overlay */
#uploadOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#uploadOverlay .loader {
    border: 6px solid rgba(255, 255, 255, 0.1);
    border-top: 6px solid #667eea;
    width: 60px;
    height: 60px;
    box-shadow: 0 0 40px rgba(102, 126, 234, 0.5);
}

/* Loader inline pour view_deck.php */
.random-image-section .loader {
    position: absolute;
    top: 70%;
    left: 50%;
    margin-left: -7.5px;
    margin-top: -7.5px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
    width: 15px;
    height: 15px;
    border-width: 2px;
}

.random-image-section .loader.show {
    opacity: 1;
    visibility: visible;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== FOOTER STYLES ==================== */

.site-footer {
    background: rgba(22, 27, 34, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 60px 0 30px;
    margin-top: 60px;
    position: relative;
    z-index: 10;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
}

.site-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-logo {
    font-family: 'Reality Hyper', Inter, sans-serif;
    font-size: 1.8rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    font-weight: 400;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    font-size: 0.95rem;
    max-width: 300px;
}

.footer-links h4 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 600;
    position: relative;
    display: inline-block;
}

.footer-links h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 30px;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
}

.footer-links a:hover {
    color: #667eea;
    transform: translateX(5px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 30px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 0;
}

/* ==================== CARD MEANINGS ==================== */

.meanings-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.meaning-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.meaning-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.meaning-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.meaning-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.meaning-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meaning-input-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.meaning-input-group textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.meaning-input-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.meaning-input-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 900px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
    
    .footer-brand {
        grid-column: 1 / -1;
    }
    
    .essence {
        width: 95%;
    }
    
    .essence h1 {
        font-size: 1.5rem;
    }
    
    .deck-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 20px;
    }
}

@media screen and (max-width: 600px) {
    .site-footer {
        padding: 40px 0 20px;
        margin-top: 40px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 35px;
    }
    
    .footer-brand {
        grid-column: 1;
    }
    
    .footer-brand p {
        margin: 0 auto;
    }
    
    .footer-links h4 {
        display: block;
        width: 100%;
    }
    
    .footer-links h4::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-links a:hover {
        transform: translateX(0) scale(1.05);
    }
    
    .essence h1 {
        width: 100%;
        font-size: 1.3rem;
        padding: 12px 20px;
    }
    
    .essence button {
        width: 100%;
        max-width: 300px;
    }
    
    .essence input[type="text"],
    .essence select {
        width: 100%;
    }
    
    .deck-grid {
        grid-template-columns: 1fr;
    }
    
    .essence-engine-title img {
        max-width: 100%;
    }
    
    #dropArea {
        padding: 30px 15px;
    }
}