/* Indian War Theme Pong Game Styles */

:root {
    --war-saffron: #FF9933;
    --war-red: #B22222;
    --war-gold: #FFD700;
    --war-bronze: #CD7F32;
    --war-dark: #1a0f0a;
    --war-darker: #0f0a06;
    --war-light: #f4e4c0;
    --war-green: #138808;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    position: fixed;
    width: 100%;
}

body {
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, var(--war-darker) 0%, var(--war-dark) 50%, var(--war-red) 100%);
    background-attachment: fixed;
    color: var(--war-light);
}

.container-fluid {
    padding: 0;
    margin: 0;
    overflow: hidden;
    height: 100vh;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(255, 153, 51, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(178, 34, 34, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
    background-size: 400px 400px, 300px 300px, 500px 500px;
    background-position: 0 0, 200px 200px, 100px 50px;
    animation: movingBackground 20s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes movingBackground {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-20px, -20px); }
}

/* Header Styling */
header {
    background: linear-gradient(90deg, var(--war-dark) 0%, var(--war-red) 50%, var(--war-dark) 100%);
    box-shadow: 0 2px 10px rgba(178, 34, 34, 0.3);
    height: 70px;
    display: flex;
    align-items: center;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.user-profile-section {
    flex: 0 0 auto;
    min-width: fit-content;
    display: flex;
    justify-content: flex-end;
}

.title-section {
    flex: 1 1 auto;
    text-align: center;
}

.logo-section {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

@media (max-width: 768px) {
    header {
        height: 50px;
    }
    
    header .container {
        padding: 0 8px;
    }
    
    header h1 {
        font-size: 1.4rem !important;
    }
    
    header h1 small {
        font-size: 0.7rem !important;
    }
    
    .game-logo {
        height: 36px;
    }
    
    .title-section {
        display: none !important;
    }
    
    .user-profile-section {
        order: 2;
        margin-left: auto;
    }
    
    .logo-section {
        order: 1;
    }
}

@media (max-width: 576px) {
    .game-logo {
        height: 34px;
    }
    
    header {
        height: 50px;
    }
}

@media (min-width: 769px) {
    .title-section h1 .sanskrit-title {
        font-size: 1.8rem;
    }
}

.sanskrit-title {
    font-family: 'Kumar One', cursive;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: var(--war-gold) !important;
    font-size: 1.8rem;
}

.title-section h1 {
    margin-bottom: 0;
}

.game-subtitle {
    font-size: 0.9rem;
}

/* Game Logo */
.game-logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    transition: transform 0.3s ease;
}

.game-logo:hover {
    transform: scale(1.05);
}

/* User Profile Section */
.user-profile-section {
    position: relative;
    min-width: 120px;
}

.user-info {
    display: inline-block;
}

.user-photo {
    border: 2px solid var(--war-gold);
    object-fit: cover;
}

.user-name {
    font-size: 0.85rem;
    font-weight: bold;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    background-color: var(--war-dark) !important;
    border: 2px solid var(--war-saffron) !important;
}

.dropdown-item {
    color: var(--war-gold) !important;
    transition: background-color 0.3s ease;
}

.dropdown-item:hover {
    background-color: rgba(255, 153, 51, 0.2) !important;
    color: var(--war-gold) !important;
}

.dropdown-item i {
    margin-right: 8px;
    width: 16px;
}

@media (max-width: 768px) {
    .user-profile-section {
        min-width: auto;
    }
    
    .user-name {
        max-width: 80px;
        font-size: 0.75rem;
    }
}

/* Authentication Modal Styles */
.overlay-content input[type="email"],
.overlay-content input[type="password"],
.overlay-content input[type="text"] {
    background-color: var(--war-dark) !important;
    color: var(--war-gold) !important;
    border: 2px solid var(--war-saffron) !important;
    padding: 0.6rem;
    font-size: 0.95rem;
}

.overlay-content input:focus {
    border-color: var(--war-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 153, 51, 0.25) !important;
    outline: none;
}

.overlay-content input::placeholder {
    color: rgba(255, 215, 0, 0.5) !important;
}

.overlay-content a {
    text-decoration: none;
    transition: color 0.3s ease;
}

.overlay-content a:hover {
    color: var(--war-saffron) !important;
    text-decoration: underline;
}

.overlay-content .btn-outline-warning {
    border-width: 2px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.overlay-content .btn-outline-warning i {
    width: 20px;
    height: 20px;
}

.overlay-content code {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.overlay-content .bg-darker {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.overlay-content .alert {
    border-radius: 8px;
}

.overlay-content ol {
    padding-left: 1.2rem;
    margin-bottom: 0;
}

.overlay-content ol li {
    margin-bottom: 0.5rem;
}

/* Sidebar Styling */
.sidebar {
    background: linear-gradient(180deg, var(--war-darker) 0%, var(--war-dark) 100%);
    border-right: 2px solid var(--war-saffron);
    border-left: 2px solid var(--war-saffron);
    height: calc(100vh - 70px);
    overflow-y: auto;
    max-height: calc(100vh - 70px);
    word-wrap: break-word;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .sidebar {
        height: calc(100vh - 50px);
        max-height: calc(100vh - 50px);
    }
}

.sidebar h5, .sidebar h6 {
    color: var(--war-gold);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .p-3 {
    padding: 0.75rem !important;
}

.sidebar small {
    font-size: 0.75rem;
    word-break: break-word;
}

.sidebar .btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
}

.sidebar .mb-3 {
    margin-bottom: 0.75rem !important;
}

.sidebar .form-select {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
}

.controls-info {
    font-size: 0.8rem;
}

.controls-info small {
    line-height: 1.6;
}

/* Game Container */
.game-main {
    background: radial-gradient(ellipse at center, rgba(178, 34, 34, 0.1) 0%, rgba(26, 15, 10, 0.8) 70%);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 70px);
    max-height: calc(100vh - 70px);
    overflow: hidden;
    position: relative;
}

.game-main > .container {
    height: 100%;
    max-height: 100%;
}

.game-main > .container > .row {
    height: 100%;
    max-height: 100%;
    margin: 0;
}

.game-main .col-lg-8 {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0 5px;
}

.game-container {
    border-radius: 15px;
    background: rgba(26, 15, 10, 0.9);
    padding: 12px;
    box-shadow: 0 0 30px rgba(255, 153, 51, 0.3);
    border: 3px solid var(--war-saffron);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

/* Canvas Wrapper */
.canvas-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: 100%;
    min-height: 0;
}

/* Canvas Styling */
#gameCanvas {
    background: linear-gradient(45deg, 
        rgba(26, 15, 10, 0.9) 0%, 
        rgba(178, 34, 34, 0.2) 50%, 
        rgba(26, 15, 10, 0.9) 100%);
    border-radius: 10px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--war-gold) !important;
    display: block;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

/* Scoreboard */
.scoreboard {
    background: linear-gradient(90deg, var(--war-dark) 0%, var(--war-red) 50%, var(--war-dark) 100%);
    border: 2px solid var(--war-gold);
    border-radius: 15px;
    padding: 6px 20px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    width: auto;
    flex-shrink: 0;
}

.score-display {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--war-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-family: 'Kumar One', cursive;
    line-height: 1;
}

.player-score .fs-6 {
    font-size: 0.75rem !important;
    margin-bottom: 2px;
}

.vs-divider {
    font-size: 1.3rem;
    color: var(--war-saffron);
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* Game Overlay */
.game-overlay {
    background: rgba(26, 15, 10, 0.95);
    border: 3px solid var(--war-gold);
    border-radius: 15px;
    padding: 15px 20px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    z-index: 15;
    max-width: 95%;
}

@media (min-width: 768px) {
    .game-overlay {
        max-width: 700px;
    }
}

@media (min-width: 992px) {
    .game-overlay {
        max-width: 800px;
    }
}

.overlay-content h2 {
    font-family: 'Kumar One', cursive;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
    animation: glow 2s ease-in-out infinite alternate;
    font-size: 1.3rem;
    margin-bottom: 0.5rem !important;
}

.overlay-content p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem !important;
}

@keyframes glow {
    0% { text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8); }
    100% { text-shadow: 3px 3px 6px rgba(255, 153, 51, 0.8); }
}

/* Custom Form Controls */
.form-select {
    background-color: var(--war-dark) !important;
    color: var(--war-gold) !important;
    border-color: var(--war-saffron) !important;
}

.form-select:focus {
    border-color: var(--war-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 153, 51, 0.25) !important;
}

/* Button Styling */
.btn-warning {
    background: linear-gradient(45deg, var(--war-saffron) 0%, var(--war-gold) 100%);
    border: 2px solid var(--war-gold);
    color: var(--war-dark) !important;
    font-weight: bold;
    text-shadow: none;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-warning:hover {
    background: linear-gradient(45deg, var(--war-gold) 0%, var(--war-saffron) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.4);
}

.btn-outline-warning {
    color: var(--war-saffron) !important;
    border-color: var(--war-saffron) !important;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

.btn-outline-warning:hover {
    background: var(--war-saffron) !important;
    color: var(--war-dark) !important;
    box-shadow: 0 3px 10px rgba(255, 153, 51, 0.3);
}

.btn-danger {
    background: linear-gradient(45deg, var(--war-red) 0%, #8B0000 100%);
    border-color: var(--war-red);
    -webkit-tap-highlight-color: transparent;
}

.btn-danger:hover {
    background: linear-gradient(45deg, #8B0000 0%, var(--war-red) 100%);
    transform: translateY(-2px);
}

/* Stats Panel */
.stat-item {
    background: rgba(178, 34, 34, 0.2);
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 153, 51, 0.3);
}

.battle-log-content {
    background: rgba(26, 15, 10, 0.8);
    border: 1px solid var(--war-bronze);
    border-radius: 8px;
    padding: 8px;
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.75rem;
}

.battle-log-content::-webkit-scrollbar {
    width: 6px;
}

.battle-log-content::-webkit-scrollbar-track {
    background: var(--war-dark);
    border-radius: 3px;
}

.battle-log-content::-webkit-scrollbar-thumb {
    background: var(--war-saffron);
    border-radius: 3px;
}

/* Mobile Controls */
.mobile-controls {
    background: linear-gradient(90deg, var(--war-dark) 0%, var(--war-red) 50%, var(--war-dark) 100%) !important;
    border-top: 3px solid var(--war-saffron) !important;
    padding: 0.3rem 0.35rem !important;
    height: auto;
}

.mobile-controls .btn-sm {
    font-size: 0.7rem;
    padding: 0.3rem 0.35rem;
    line-height: 1.1;
}

.mobile-controls .btn-group .btn-sm {
    padding: 0.35rem 0.25rem;
}

.mobile-controls .row.mb-2 {
    margin-bottom: 0.3rem !important;
}

.mobile-controls .row.g-1 {
    --bs-gutter-y: 0.2rem;
    --bs-gutter-x: 0.25rem;
}

.mobile-controls .row.g-2 {
    --bs-gutter-y: 0.3rem;
    --bs-gutter-x: 0.3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-main {
        padding: 3px;
        height: calc(100vh - 50px - 90px);
        min-height: 0;
        max-height: calc(100vh - 50px - 90px);
    }
    
    .scoreboard {
        padding: 4px 8px;
        margin-top: 0px;
    }
    
    .score-display {
        font-size: 1.2rem;
    }
    
    .game-container {
        padding: 2px;
        gap: 2px;
        height: 100%;
        max-height: 100%;
    }
    
    .canvas-wrapper {
        min-height: 0;
        max-height: 100%;
        height: 100%;
        width: 100%;
    }
    
    .overlay-content h2 {
        font-size: 1.3rem;
    }
    
    /* Auth modal on tablet */
    .overlay-content input {
        font-size: 0.9rem;
        padding: 0.5rem;
    }
    
    .overlay-content .btn {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .sanskrit-title {
        font-size: 1.8rem;
    }
    
    .score-display {
        font-size: 1.1rem;
    }
    
    .game-container {
        padding: 2px;
        margin: 0;
        gap: 2px;
    }
    
    .scoreboard {
        padding: 3px 6px;
    }
    
    .player-score .fs-6 {
        font-size: 0.6rem !important;
    }
    
    .vs-divider {
        font-size: 1rem;
    }
    
    .canvas-wrapper {
        min-height: 0;
        max-height: 100%;
        height: 100%;
        width: 100%;
    }
    
    .overlay-content h2 {
        font-size: 1.1rem;
    }
    
    .overlay-content p {
        font-size: 0.8rem;
    }
    
    .game-overlay {
        max-width: 95%;
        padding: 8px 12px;
    }
    
    /* Auth modal on mobile */
    .overlay-content input {
        font-size: 0.85rem;
        padding: 0.45rem;
    }
    
    .overlay-content .btn {
        font-size: 0.85rem;
        padding: 0.5rem;
    }
    
    .overlay-content h2 {
        font-size: 1.2rem;
    }
}

/* Canvas Responsive */
@media (max-width: 1200px) {
    #gameCanvas {
        max-width: 100%;
        height: auto;
    }
}

/* Custom Animations */
@keyframes warriorEntry {
    0% { opacity: 0; transform: translateX(-100px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes battleReady {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.warrior-enter {
    animation: warriorEntry 1s ease-out;
}

.battle-ready {
    animation: battleReady 0.8s ease-out;
}

/* Special Effects */
.victory-effect {
    background: radial-gradient(circle, var(--war-gold) 0%, transparent 70%);
    animation: victoryPulse 1s ease-in-out;
}

@keyframes victoryPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Border decorations */
.border-decoration {
    position: relative;
}

.border-decoration::before,
.border-decoration::after {
    content: '|';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--war-bronze);
    font-size: 1.2rem;
}

.border-decoration::before {
    left: -25px;
}

.border-decoration::after {
    right: -25px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states for accessibility */
button:focus,
select:focus {
    outline: 2px solid var(--war-gold);
    outline-offset: 2px;
}

/* High Scores Styling */
.high-scores-list {
    max-height: 500px;
    overflow-y: auto;
    min-height: 200px;
}

.score-entry {
    background: rgba(178, 34, 34, 0.2);
    transition: background-color 0.3s ease;
}

.score-entry:hover {
    background: rgba(255, 153, 51, 0.2);
}

.high-scores-list::-webkit-scrollbar {
    width: 6px;
}

.high-scores-list::-webkit-scrollbar-track {
    background: var(--war-dark);
    border-radius: 3px;
}

.high-scores-list::-webkit-scrollbar-thumb {
    background: var(--war-saffron);
    border-radius: 3px;
}

/* Pagination Controls */
.pagination-controls {
    margin-top: 15px;
    margin-bottom: 10px;
}

.pagination-controls .btn-sm {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
}

.pagination-controls .btn-outline-warning:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls span {
    font-weight: bold;
    min-width: 60px;
    text-align: center;
}

/* Player name input styling */
#playerNameInput {
    background-color: var(--war-dark) !important;
    color: var(--war-gold) !important;
    border-color: var(--war-saffron) !important;
}

#playerNameInput:focus {
    border-color: var(--war-gold) !important;
    box-shadow: 0 0 0 0.25rem rgba(255, 153, 51, 0.25) !important;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    /* Hide sidebars on mobile, show mobile controls instead */
    .sidebar {
        display: none !important;
    }
    
    .game-main {
        padding: 2px;
        height: calc(100vh - 50px - 88px);
        max-height: calc(100vh - 50px - 88px);
        min-height: 0;
    }
    
    header {
        height: 55px;
    }
    
    /* Pagination on mobile */
    .pagination-controls {
        gap: 0.5rem !important;
    }
    
    .pagination-controls .btn-sm {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    .pagination-controls span {
        font-size: 0.85rem;
        min-width: 50px;
    }
}

@media (min-width: 768px) {
    /* Show sidebars on tablet and desktop */
    .sidebar {
        display: block !important;
    }
    
    /* Hide mobile controls on larger screens */
    .mobile-controls {
        display: none !important;
    }
}

/* Very small screens optimization */
@media (max-width: 400px) {
    header {
        height: 48px;
    }
    
    .game-logo {
        height: 30px;
    }
    
    .game-main {
        height: calc(100vh - 48px - 83px);
        max-height: calc(100vh - 48px - 83px);
        min-height: 0;
        padding: 2px;
    }
    
    .game-container {
        padding: 2px;
        gap: 1px;
    }
    
    .scoreboard {
        padding: 2px 5px;
    }
    
    .score-display {
        font-size: 0.95rem;
    }
    
    .player-score .fs-6 {
        font-size: 0.55rem !important;
    }
    
    .vs-divider {
        font-size: 0.85rem;
    }
    
    .mobile-controls {
        padding: 0.25rem 0.3rem !important;
    }
    
    .mobile-controls .btn-sm {
        font-size: 0.65rem;
        padding: 0.28rem 0.3rem;
    }
    
    .mobile-controls .btn-group .btn-sm {
        padding: 0.32rem 0.2rem;
    }
}