/* AETHER CHRONICLES - PREMIUM PRE-BATTLE SCREEN v1753442000 */

/* ============================================================
   CORE LAYOUT SYSTEM - OPTIMIZED FOR PERFECT FIT
   - Grid-based layout inspired by modern card games
   - Proper viewport management and spacing
   - Responsive design with mobile-first approach
   ============================================================ */

/* Main Container - Dark Premium Background */
#screen-pre-battle-setup {
    background: 
        radial-gradient(ellipse at top left, rgba(138, 43, 226, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(30, 144, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at center, rgba(0, 0, 0, 0.2) 0%, transparent 70%),
        linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #0f1318 100%) !important;
    
    position: fixed !important;
    top: 60px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: calc(100vh - 60px) !important;
    
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 1000 !important;
    
    display: flex;
    flex-direction: column;
    backdrop-filter: none !important;
}

/* Title Section */
#screen-pre-battle-setup h2 {
    text-align: center;
    font-size: clamp(1.8rem, 3.5vw, 2.5rem);
    font-weight: 800;
    margin: 20px 0 30px;
    padding: 0;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(138, 43, 226, 0.5);
    position: relative;
    z-index: 2;
}

/* Main Layout Container */
.pre-battle-layout {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    padding: 0 30px 30px !important;
    box-sizing: border-box !important;
    flex: 1 !important;
}

/* Desktop Layout - 2 Column Grid */
@media (min-width: 1024px) {
    .pre-battle-layout {
        grid-template-columns: 1fr 1fr !important;
        grid-template-areas:
            "difficulty opponent"
            "config preview"
            "actions actions" !important;
        gap: 25px !important;
        padding: 0 40px 40px !important;
    }
    
    .pre-battle-difficulty { grid-area: difficulty !important; }
    .pre-battle-opponent-selection { grid-area: opponent !important; }
    .pre-battle-configuration { grid-area: config !important; }
    .pre-battle-player-preview { grid-area: preview !important; }
    .pre-battle-actions { grid-area: actions !important; }
}

/* ============================================================
   SECTION STYLING - CARD GAME INSPIRED DESIGN
   ============================================================ */

/* Base Section Style */
.pre-battle-difficulty,
.pre-battle-opponent-selection,
.pre-battle-configuration,
.pre-battle-player-preview {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.08) 0%, 
        rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: visible;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

/* Section Hover Effect */
.pre-battle-difficulty:hover,
.pre-battle-opponent-selection:hover,
.pre-battle-configuration:hover,
.pre-battle-player-preview:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(138, 43, 226, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Section Headers */
.pre-battle-difficulty h3,
.pre-battle-opponent-selection h3,
.pre-battle-configuration h3,
.pre-battle-player-preview h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 20px 0;
    text-align: center;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* ============================================================
   DIFFICULTY SELECTION - CLEAN CARD DESIGN
   ============================================================ */

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.difficulty-option {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.06) 0%, 
        rgba(255, 255, 255, 0.02) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Remove any existing ::after pseudo-elements that create spinning rectangles */
.difficulty-option::after {
    display: none !important;
}

/* Difficulty Option Hover */
.difficulty-option:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.12) 0%, 
        rgba(255, 255, 255, 0.06) 100%);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Difficulty Selected State */
.difficulty-option.selected {
    background: linear-gradient(135deg, 
        rgba(138, 43, 226, 0.2) 0%, 
        rgba(138, 43, 226, 0.1) 100%);
    border-color: #8a2be2;
    box-shadow: 
        0 5px 20px rgba(138, 43, 226, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Difficulty Headers */
.difficulty-option h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Difficulty Descriptions */
.difficulty-option p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.4;
}

/* Difficulty Icons - Simple and Clean */
.difficulty-option[data-difficulty="novice"] h4::before {
    content: "🌟";
    font-size: 1.4em;
}

.difficulty-option[data-difficulty="adept"] h4::before {
    content: "⚔️";
    font-size: 1.4em;
}

.difficulty-option[data-difficulty="master"] h4::before {
    content: "🔥";
    font-size: 1.4em;
}

.difficulty-option[data-difficulty="legend"] h4::before {
    content: "👑";
    font-size: 1.4em;
}

/* Difficulty Color Coding */
.difficulty-option[data-difficulty="novice"] {
    border-left: 4px solid #4caf50;
}

.difficulty-option[data-difficulty="adept"] {
    border-left: 4px solid #2196f3;
}

.difficulty-option[data-difficulty="master"] {
    border-left: 4px solid #ff9800;
}

.difficulty-option[data-difficulty="legend"] {
    border-left: 4px solid #f44336;
}

/* ============================================================
   OPPONENT SELECTION - CARD GALLERY STYLE
   ============================================================ */

.opponent-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom Scrollbar */
.opponent-list::-webkit-scrollbar {
    width: 8px;
}

.opponent-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.opponent-list::-webkit-scrollbar-thumb {
    background: rgba(138, 43, 226, 0.5);
    border-radius: 4px;
}

.opponent-list::-webkit-scrollbar-thumb:hover {
    background: rgba(138, 43, 226, 0.7);
}

.opponent-option {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.06) 0%, 
        rgba(255, 255, 255, 0.02) 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 20px;
}

.opponent-option:hover {
    background: linear-gradient(135deg, 
        rgba(30, 144, 255, 0.15) 0%, 
        rgba(30, 144, 255, 0.05) 100%);
    border-color: rgba(30, 144, 255, 0.5);
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(30, 144, 255, 0.2);
}

.opponent-option.selected {
    background: linear-gradient(135deg, 
        rgba(30, 144, 255, 0.2) 0%, 
        rgba(30, 144, 255, 0.1) 100%);
    border-color: #1e90ff;
    box-shadow: 
        0 5px 20px rgba(30, 144, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.opponent-image {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.opponent-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.opponent-details h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #ffffff;
}

.opponent-details p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 3px 0;
    line-height: 1.3;
}

.opponent-key-cards {
    font-style: italic;
    color: rgba(255, 215, 0, 0.8) !important;
}

.win-record {
    font-weight: 600;
    color: rgba(76, 175, 80, 0.9) !important;
}

/* ============================================================
   CONFIGURATION SECTION - CLEAN FORM DESIGN
   ============================================================ */

.config-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.config-option {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s ease;
}

.config-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.config-option label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}

.config-option input,
.config-option select {
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.config-option input:focus,
.config-option select:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

/* ============================================================
   DECK PREVIEW SECTION
   ============================================================ */

.deck-selection-container {
    margin-bottom: 15px;
}

.deck-selection-container label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}

#deck-selection-dropdown {
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    font-size: 1rem;
    margin-bottom: 10px;
}

.view-deck-btn {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #8a2be2 0%, #6a1fb8 100%);
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-deck-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #9a3bef 0%, #7a2fc8 100%);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
    transform: translateY(-1px);
}

.view-deck-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.deck-preview {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================================
   ACTION BUTTONS - PREMIUM DESIGN
   ============================================================ */

.pre-battle-actions {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.05) 0%, 
        rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 30px;
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

#start-battle-button {
    padding: 18px 50px;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

#start-battle-button:hover {
    background: linear-gradient(135deg, #5cbf60 0%, #55b059 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

#return-to-menu-button {
    padding: 15px 35px;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#return-to-menu-button:hover {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(255, 255, 255, 0.08) 100%);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* ============================================================
   ANIMATIONS AND EFFECTS
   ============================================================ */

/* Subtle Background Animation */
#screen-pre-battle-setup::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, 
        rgba(138, 43, 226, 0.1) 0%, 
        transparent 70%);
    animation: pulse 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

/* Screen Entry Animation */
#screen-pre-battle-setup {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(20px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* Selection Feedback */
.difficulty-option.selected::before,
.opponent-option.selected::before {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 15px;
    width: 24px;
    height: 24px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    animation: checkIn 0.3s ease-out;
}

@keyframes checkIn {
    from { 
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    to { 
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 1024px) {
    .pre-battle-layout {
        padding: 0 20px 20px !important;
        gap: 20px !important;
    }
    
    .pre-battle-difficulty,
    .pre-battle-opponent-selection,
    .pre-battle-configuration,
    .pre-battle-player-preview {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    #screen-pre-battle-setup h2 {
        font-size: 1.5rem;
        margin: 15px 0 20px;
    }
    
    .pre-battle-layout {
        padding: 0 15px 15px !important;
        gap: 15px !important;
    }
    
    .pre-battle-actions {
        flex-direction: column;
        padding: 20px;
    }
    
    #start-battle-button,
    #return-to-menu-button {
        width: 100%;
    }
    
    .opponent-option {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .opponent-image {
        width: 60px;
        height: 60px;
    }
}

/* ============================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================ */

/* Disable expensive effects on low-end devices */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .difficulty-option,
    .opponent-option,
    .config-option {
        border-width: 2px;
    }
}

/* Dark mode is default, but ensure compatibility */
@media (prefers-color-scheme: light) {
    /* Keep dark theme as it matches the game aesthetic */
}