/**
 * GPT Games Integration - Beautiful Professional Styles
 * Version: 1.0.2 - Complete Redesign
 */

/* Container */
.gpt-game-container {
    max-width: 980px;
    margin: 30px auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

/* Header */
.gpt-game-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 28px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.gpt-game-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gpt-game-balance {
    background: rgba(255, 255, 255, 0.3);
    padding: 14px 28px;
    border-radius: 40px;
    font-size: 17px;
    font-weight: 600;
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.balance-label {
    opacity: 0.95;
    margin-right: 12px;
    font-weight: 500;
}

.balance-amount {
    font-weight: 900;
    font-size: 22px;
}

.balance-updated {
    animation: balanceUpdate 0.6s ease;
}

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

/* Main Area */
.gpt-game-main {
    padding: 35px 40px;
    min-height: 560px;
    background: #fafbfc;
}

/* Start Screen */
.gpt-game-start-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ef 100%);
    border-radius: 18px;
    padding: 50px 35px;
}

.start-screen-content {
    text-align: center;
    max-width: 540px;
    background: white;
    padding: 65px 55px;
    border-radius: 26px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.18);
}

.start-icon {
    font-size: 84px;
    margin-bottom: 28px;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-16px); }
}

.start-screen-content h3 {
    font-size: 34px;
    color: #1a202c;
    margin: 0 0 18px 0;
    font-weight: 900;
}

.start-screen-content > p {
    font-size: 18px;
    color: #4a5568;
    margin: 0 0 18px 0;
    line-height: 1.8;
}

.start-cost {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 3px solid #ff9800;
    border-radius: 14px;
    padding: 18px 26px;
    margin: 28px 0 38px 0;
    font-size: 17px;
    color: #e65100;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(255, 152, 0, 0.25);
}

.start-cost strong {
    color: #d84315;
    font-weight: 900;
    font-size: 20px;
}

.gpt-start-game-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px 70px;
    border-radius: 40px;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gpt-start-game-button:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.gpt-start-game-button:active:not(:disabled) {
    transform: translateY(-2px) scale(1.01);
}

.gpt-start-game-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Conversation */
.gpt-game-conversation {
    background: #f8f9fa;
    border-radius: 18px;
    padding: 28px;
    min-height: 460px;
    max-height: 560px;
    overflow-y: auto;
    margin-bottom: 28px;
    box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.08);
}

.gpt-game-conversation::-webkit-scrollbar {
    width: 12px;
}

.gpt-game-conversation::-webkit-scrollbar-track {
    background: #e2e6ea;
    border-radius: 12px;
}

.gpt-game-conversation::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    border: 3px solid #e2e6ea;
}

.gpt-game-conversation::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5568d3 0%, #6a4193 100%);
}

/* Messages */
.gpt-message {
    margin-bottom: 26px;
    animation: messageAppear 0.45s ease;
}

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

.gpt-message-label {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.gpt-message-content {
    background: white;
    padding: 20px 24px;
    border-radius: 18px;
    line-height: 1.75;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.gpt-message-content p {
    margin: 0;
    color: #000000;
    font-size: 17px;
    font-weight: 600;
}

.gpt-user-message .gpt-message-label {
    color: #2563eb;
}

.gpt-user-message .gpt-message-content {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    border-left: 6px solid #2563eb;
}

.gpt-user-message .gpt-message-content p {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.gpt-assistant-message .gpt-message-label {
    color: #7c3aed;
}

.gpt-assistant-message .gpt-message-content {
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
    border-left: 6px solid #7c3aed;
}

.gpt-assistant-message .gpt-message-content p {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.gpt-tokens-used {
    position: absolute;
    top: 18px;
    right: 18px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 12px 22px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 800;
    animation: slideIn 0.4s ease;
    z-index: 10;
    box-shadow: 0 6px 18px rgba(255, 152, 0, 0.5);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Input Area */
.gpt-game-input-area {
    background: white;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.input-wrapper {
    margin-bottom: 20px;
}

.gpt-game-form textarea {
    width: 100%;
    padding: 20px 24px;
    border: 3px solid #e2e8f0;
    border-radius: 16px;
    font-size: 17px;
    font-family: inherit;
    resize: none;
    min-height: 110px;
    max-height: 240px;
    transition: all 0.3s ease;
    line-height: 1.65;
    background: #ffffff;
    box-sizing: border-box;
    color: #2d3748;
}

.gpt-game-form textarea:hover {
    border-color: #cbd5e0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.gpt-game-form textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 5px rgba(102, 126, 234, 0.18);
}

.gpt-game-form textarea::placeholder {
    color: #a0aec0;
    font-style: italic;
}

.form-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.cost-info {
    font-size: 15px;
    color: #4a5568;
    background: #edf2f7;
    padding: 12px 22px;
    border-radius: 30px;
    font-weight: 600;
    border: 2px solid #e2e8f0;
}

.prompt-cost {
    font-weight: 900;
    color: #667eea;
    font-size: 16px;
}

.gpt-submit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 46px;
    border-radius: 35px;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gpt-submit-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(102, 126, 234, 0.5);
}

.gpt-submit-button:active:not(:disabled) {
    transform: translateY(-1px);
}

.gpt-submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.button-spinner {
    animation: spin 1s linear infinite;
}

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

/* Error */
.gpt-game-error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 5px solid #f44336;
    padding: 20px 24px;
    border-radius: 14px;
    margin-top: 20px;
    color: #c62828;
    font-size: 16px;
    box-shadow: 0 3px 10px rgba(244, 67, 54, 0.25);
}

.gpt-game-error strong {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
}

/* Footer */
.gpt-game-footer {
    background: #f8f9fa;
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    border-top: 2px solid #e2e8f0;
}

.gpt-new-game-button {
    background: white;
    color: #667eea;
    border: 3px solid #667eea;
    padding: 13px 34px;
    border-radius: 28px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gpt-new-game-button:hover {
    background: #667eea;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}

.gpt-game-info {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

/* Login/Membership Required */
.gpt-game-login-required,
.gpt-game-membership-required {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 3px solid #ff9800;
    border-radius: 18px;
    padding: 45px;
    text-align: center;
    font-size: 18px;
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.25);
}

.gpt-game-login-required p,
.gpt-game-membership-required p {
    margin: 0;
    color: #e65100;
    line-height: 1.8;
    font-weight: 600;
}

.gpt-game-login-required a,
.gpt-game-membership-required a {
    color: #667eea;
    font-weight: 800;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: border-color 0.2s ease;
}

.gpt-game-login-required a:hover,
.gpt-game-membership-required a:hover {
    border-bottom-color: #667eea;
}

/* Responsive */
@media (max-width: 768px) {
    .gpt-game-container {
        margin: 15px;
        border-radius: 18px;
    }

    .gpt-game-header {
        padding: 22px 28px;
    }

    .gpt-game-header h2 {
        font-size: 24px;
    }

    .gpt-game-balance {
        padding: 12px 24px;
        font-size: 16px;
    }

    .balance-amount {
        font-size: 20px;
    }

    .gpt-game-main {
        padding: 25px 28px;
    }

    .gpt-game-start-screen {
        padding: 35px 25px;
    }

    .start-screen-content {
        padding: 45px 35px;
    }

    .start-icon {
        font-size: 68px;
    }

    .start-screen-content h3 {
        font-size: 28px;
    }

    .gpt-start-game-button {
        padding: 18px 55px;
        font-size: 18px;
        width: 100%;
    }

    .gpt-game-conversation {
        padding: 22px;
        min-height: 370px;
        max-height: 470px;
    }

    .gpt-game-input-area {
        padding: 22px;
    }

    .gpt-game-form textarea {
        padding: 18px 20px;
        font-size: 16px;
    }

    .form-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .cost-info {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .gpt-submit-button {
        width: 100%;
        justify-content: center;
        padding: 18px 46px;
    }

    .gpt-game-footer {
        padding: 22px 28px;
        flex-direction: column;
        text-align: center;
    }

    .gpt-new-game-button {
        width: 100%;
    }

    .gpt-game-login-required,
    .gpt-game-membership-required {
        padding: 35px 28px;
        font-size: 17px;
    }
}
