/**
 * Sultry City Gift System - CSS
 * Version: 1.0.0
 * Optimized version with enhanced animations and effects
 */

/* =====================================
   1. Modal Styles
   ===================================== */

.scgs-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(5px);
}

.scgs-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.scgs-modal-content {
    background: #1a1a2e;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.scgs-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.scgs-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* =====================================
   2. Gift Interface
   ===================================== */

.gift-interface {
    color: white;
    position: relative;
}

.gift-interface.loading {
    opacity: 0.6;
    pointer-events: none;
}

.gift-interface.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.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

/* Character Header */
.gift-character-header {
    position: relative;
    height: 250px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

.gift-character-header.faction-aegis {
    background: linear-gradient(135deg, #5DADE2 0%, #2E86C1 100%);
}

.gift-character-header.faction-undershade {
    background: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%);
}

.gift-character-header.faction-velvet {
    background: linear-gradient(135deg, #ba557f 0%, #8B0051 100%);
}

.gift-character-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}

.gift-character-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
}

.gift-character-info h2 {
    margin: 0;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.character-faction {
    color: #ffd700;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* User Balance */
.user-balance {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.balance-label {
    color: #aaa;
    font-size: 0.9em;
}

.balance-amount {
    color: #ffd700;
    font-size: 1.3em;
    font-weight: bold;
}

/* Gift Selection */
.gift-selection-section {
    padding: 30px;
}

.section-title {
    color: #ffd700;
    font-size: 1.2em;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gift-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.gift-item {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.gift-item::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1), transparent);
    transform: scale(0);
    transition: transform 0.5s ease;
}

.gift-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gift-item:hover::before {
    transform: scale(1);
}

.gift-item.selected {
    background: rgba(212, 175, 55, 0.2);
    border-color: #d4af37;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.4);
}

.gift-icon {
    font-size: 3em;
    margin-bottom: 10px;
    display: block;
}

.gift-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: white;
}

.gift-price {
    color: #ffd700;
    font-size: 0.9em;
}

/* Gift Message */
.gift-message-section {
    padding: 0 30px 30px;
}

.gift-message {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.gift-message:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Confirm Section */
.gift-confirm-section {
    padding: 30px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gift-summary {
    color: #aaa;
}

.selected-gift-info {
    color: white;
    font-weight: bold;
}

.selected-name {
    color: #ffd700;
}

.confirm-gift-button {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 30px;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.confirm-gift-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.confirm-gift-button:hover::before {
    width: 300px;
    height: 300px;
}

.confirm-gift-button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.confirm-gift-button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

/* =====================================
   3. Top Supporters Section
   ===================================== */

.gift-supporters-section {
    padding: 30px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.top-supporters-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.supporter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.supporter-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.supporter-rank {
    width: 30px;
    height: 30px;
    background: #d4af37;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #1a1a2e;
}

.supporter-rank.rank-1 { background: #FFD700; }
.supporter-rank.rank-2 { background: #C0C0C0; }
.supporter-rank.rank-3 { background: #CD7F32; }

.supporter-name {
    flex: 1;
    margin-left: 15px;
    color: white;
}

.supporter-amount {
    color: #ffd700;
    font-weight: bold;
}

/* =====================================
   4. Gift Animations
   ===================================== */

/* Base for gift effect display */
.gift-effect-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 100px;
}

/* Pulse Animation (10 CR) */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.gift-effect-display.effect-pulse::before {
    content: '💝';
    animation: pulse 1s ease-in-out 3;
}

/* Bounce Animation (100 CR) */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-30px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-15px); }
}

.gift-effect-display.effect-bounce::before {
    content: '🎁';
    animation: bounce 1.5s ease-in-out;
}

/* Rotate Animation (500 CR) */
@keyframes rotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.5); }
    100% { transform: rotate(360deg) scale(1); }
}

.gift-effect-display.effect-rotate::before {
    content: '✨';
    animation: rotate 2s ease-in-out;
}

/* Flip 3D Animation (1000 CR) */
@keyframes flip3d {
    0% { transform: perspective(400px) rotateY(0) scale(1); }
    50% { transform: perspective(400px) rotateY(180deg) scale(1.5); }
    100% { transform: perspective(400px) rotateY(360deg) scale(1); }
}

.gift-effect-display.effect-flip3d::before {
    content: '💎';
    animation: flip3d 2s ease-in-out;
}

/* Shake Animation (2000 CR) */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-10px) rotate(-5deg); }
    20% { transform: translateX(10px) rotate(5deg); }
    30% { transform: translateX(-10px) rotate(-5deg); }
    40% { transform: translateX(10px) rotate(5deg); }
    50% { transform: translateX(0) scale(1.2); }
    60% { transform: scale(1.5); }
    70% { transform: scale(1.3); }
    80% { transform: scale(1.5); }
    90% { transform: scale(1.3); }
}

.gift-effect-display.effect-shake::before {
    content: '🌟';
    animation: shake 2.5s ease-in-out;
    filter: drop-shadow(0 0 30px gold);
}

/* Explosion Animation (5000 CR) */
@keyframes explosion {
    0% {
        transform: scale(0);
        opacity: 1;
        box-shadow: 0 0 0 rgba(255,215,0,0.8);
    }
    50% {
        transform: scale(2);
        opacity: 0.8;
        box-shadow: 0 0 100px rgba(255,215,0,0.6);
    }
    100% {
        transform: scale(4);
        opacity: 0;
        box-shadow: 0 0 200px rgba(255,215,0,0);
    }
}

.effect-explosion {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    margin: -50px 0 0 -50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,215,0,1) 0%, rgba(255,165,0,0.8) 50%, transparent 70%);
    animation: explosion 3s ease-out;
    pointer-events: none;
    z-index: 999999;
}

/* Additional Effects */
@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes flash {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

.screen-flash {
    animation: flash 0.5s ease-out;
}

.floating-emoji {
    position: fixed;
    pointer-events: none;
    animation: floatUp 3s ease-out forwards;
}

/* =====================================
   5. Canvas Effect Styles
   ===================================== */

#gift-effect-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999998;
    display: none;
}

#gift-effect-canvas.active {
    display: block;
}

/* =====================================
   6. Broadcast Notification
   ===================================== */

.gift-broadcast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 999997;
    display: none;
    animation: slideDown 0.5s ease;
}

.gift-broadcast.active {
    display: block;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Thank Message Display */
.thank-message-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 30px 50px;
    border-radius: 20px;
    font-size: 1.5em;
    text-align: center;
    z-index: 999999;
    animation: fadeIn 0.5s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

/* =====================================
   7. Character Page Integration
   ===================================== */

.character-gift-section {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.character-earnings {
    font-size: 1.1em;
}

.earnings-label {
    color: #666;
}

.earnings-amount {
    color: #d4af37;
    font-weight: bold;
    font-size: 1.2em;
}

.gift-button {
    padding: 12px 30px;
    background: linear-gradient(135deg, #ba557f 0%, #ff69b4 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gift-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(186, 85, 127, 0.4);
}

/* =====================================
   8. Mobile Responsive
   ===================================== */

@media (max-width: 768px) {
    .scgs-modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .gift-character-header {
        height: 200px;
    }
    
    .gift-character-info h2 {
        font-size: 1.8em;
    }
    
    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .gift-item {
        padding: 15px 10px;
    }
    
    .gift-icon {
        font-size: 2em;
    }
    
    .gift-name {
        font-size: 0.9em;
    }
    
    .gift-confirm-section {
        flex-direction: column;
        gap: 20px;
    }
    
    .confirm-gift-button {
        width: 100%;
    }
    
    .character-gift-section {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .gift-button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .gift-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gift-supporters-section,
    .gift-selection-section,
    .gift-message-section {
        padding: 20px;
    }
}

/* =====================================
   9. Utility Animations
   ===================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 50px;
    color: white;
    font-size: 1.2em;
}

.loading-spinner::before {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}