/* CSS Reset & Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #4ecdc4;
    --warning-color: #feca57;
    --danger-color: #ff6b6b;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    
    --font-family: 'Poppins', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    color: var(--dark-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #6a4190;
}

.btn-large {
    padding: 15px 30px;
    font-size: 16px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-btn:hover {
    color: var(--dark-color);
}

/* Authentication Styles */
.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab-btn.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--dark-color);
}

.form-group {
    margin-bottom: 15px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.auth-btn:hover {
    background: var(--primary-dark);
}

.error-message {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
}

/* App Layout */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.app-header {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    font-weight: 500;
    color: var(--dark-color);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
}
.username-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 5px;
    font-size: 12px;
    color: #856404;
}
.username-availability {
    margin-top: 5px;
    font-size: 12px;
    font-weight: 500;
}

.username-availability.available {
    color: #28a745;
}

.username-availability.taken {
    color: #dc3545;
}

.checkbox-group {
    margin: 15px 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
}
.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 2px;
}

/* Welcome Screen */
.welcome-screen {
    text-align: center;
    padding: 60px 0;
}

.welcome-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.welcome-content p {
    font-size: 1.2em;
    color: rgba(255,255,255,0.9);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Game Interface */
.game-interface {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--box-shadow);
    margin-bottom: 40px;
}

.game-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 500;
    color: var(--dark-color);
}

.control-group select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
}

/* Game Statistics */
.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow);
}

.stat-value {
    display: block;
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Chessboard */
.chessboard-container {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.chessboard {
    display: grid;
    border: 3px solid var(--dark-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.chessboard.solved {
    border-color: var(--success-color);
    box-shadow: 0 0 30px rgba(78, 205, 196, 0.5);
}

.square {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 30px;
    position: relative;
}

.square:hover {
    opacity: 0.8;
    transform: scale(0.95);
}

.square.light {
    background-color: #f0d9b5;
}

.square.dark {
    background-color: #b58863;
}

.square.queen::before {
    content: '♛';
    color: var(--dark-color);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    animation: placeQueen 0.3s ease;
}

@keyframes placeQueen {
    from {
        transform: scale(0) rotate(180deg);
    }
    to {
        transform: scale(1) rotate(0deg);
    }
}

.square.conflict {
    background-color: var(--danger-color) !important;
    animation: conflictPulse 0.5s ease-in-out;
}

@keyframes conflictPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.square.hint {
    background-color: var(--warning-color) !important;
    animation: hintGlow 1s ease-in-out infinite;
}

@keyframes hintGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Game Status */
.game-status {
    text-align: center;
    margin: 20px 0;
}

.message {
    font-size: 18px;
    font-weight: 600;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    transition: var(--transition);
}

.message.success {
    background: linear-gradient(135deg, var(--success-color), #45b7aa);
    color: white;
    animation: successBounce 0.6s ease;
}

@keyframes successBounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.message.info {
    background: var(--light-color);
    color: var(--dark-color);
    border: 2px solid var(--border-color);
}

.conflict-info {
    color: var(--danger-color);
    font-weight: 500;
}

/* Leaderboard */
.leaderboard-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--box-shadow);
    margin-bottom: 40px;
}

.leaderboard-section h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8em;
    color: var(--dark-color);
}

.leaderboard-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.leaderboard-container {
    overflow-x: auto;
}

#leaderboardTable {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

#leaderboardTable th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

#leaderboardTable td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

#leaderboardTable tbody tr:hover {
    background-color: var(--light-color);
}

#leaderboardTable tbody tr:nth-child(1) {
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    font-weight: 600;
}

#leaderboardTable tbody tr:nth-child(2) {
    background: linear-gradient(135deg, #c0c0c0, #e2e8f0);
    font-weight: 500;
}

#leaderboardTable tbody tr:nth-child(3) {
    background: linear-gradient(135deg, #cd7f32, #d69e2e);
    font-weight: 500;
}

/* Footer */
.app-footer {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    color: var(--dark-color);
}

.footer-stats {
    margin-top: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-spinner p {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1500;
}

.toast {
    background: white;
    border-left: 5px solid var(--success-color);
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    animation: toastSlideIn 0.3s ease;
    max-width: 300px;
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 15px;
        height: 60px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .main-content {
        padding: 20px 15px;
    }
    
    .welcome-content h2 {
        font-size: 2em;
    }
    
    .game-interface {
        padding: 20px;
    }
    
    .square {
        width: 45px;
        height: 45px;
        font-size: 25px;
    }
    
    .game-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 1.5em;
    }
}

@media (max-width: 480px) {
    .square {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    .modal-content {
        padding: 20px;
        margin: 20px;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 15px;
    }
}
/* Header Navigation */
.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
}

.logo {
    justify-self: start;
}

.header-nav {
    justify-self: center;
}

.user-section {
    justify-self: end;
}

.nav-btn {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    color: var(--dark-color);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.info-icon {
    font-size: 16px;
}

/* About Us Modal */
.about-us-modal {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
}

.about-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.about-header h2 {
    color: var(--primary-color);
    margin: 0 0 10px 0;
    font-size: 28px;
}

.about-subtitle {
    color: #666;
    font-style: italic;
    margin: 0;
    font-size: 16px;
}

/* Developer Card */
.developer-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    margin-bottom: 40px;
    align-items: start;
}

.developer-image {
    position: relative;
    text-align: center;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.profile-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.image-overlay {
    margin-top: 10px;
}

.developer-title {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.developer-info {
    padding-left: 10px;
}

.developer-name {
    color: var(--dark-color);
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 700;
}

.developer-description {
    color: #666;
    line-height: 1.6;
    margin: 0 0 25px 0;
    font-size: 15px;
}

/* Tech Stack */
.tech-stack h4 {
    color: var(--dark-color);
    margin: 0 0 10px 0;
    font-size: 16px;
}

.tech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Contact Section */
.contact-section {
    background: var(--light-color);
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.contact-section h4 {
    color: var(--dark-color);
    margin: 0 0 20px 0;
    text-align: center;
    font-size: 18px;
}

.contact-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.contact-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    text-decoration: none;
}

.email-link:hover {
    border-color: #ea4335;
    background: #fef2f2;
}

.linkedin-link:hover {
    border-color: #0077b5;
    background: #f0f8ff;
}

.github-link:hover {
    border-color: #333;
    background: #f8f9fa;
}

.portfolio-link:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.contact-icon {
    font-size: 18px;
}

/* Project Info */
.project-info {
    margin-bottom: 30px;
}

.project-info h4 {
    color: var(--dark-color);
    margin: 0 0 20px 0;
    font-size: 18px;
    text-align: center;
}

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

.project-stats .stat-item {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
}

.project-stats .stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.project-stats .stat-label {
    font-size: 11px;
    opacity: 0.9;
    text-transform: uppercase;
}

.project-description {
    color: #666;
    line-height: 1.6;
    text-align: center;
    font-size: 14px;
    margin: 0;
}

/* Modal Footer */
.modal-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.footer-text {
    color: #666;
    font-style: italic;
    margin: 0;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        grid-template-columns: 1fr auto;
        gap: 10px;
    }
    
    .header-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
        margin-top: 10px;
    }
    
    .about-us-modal {
        padding: 20px;
        margin: 10px;
    }
    
    .developer-card {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .developer-info {
        padding-left: 0;
    }
    
    .contact-links {
        grid-template-columns: 1fr;
    }
    
    .project-stats {
        grid-template-columns: 1fr;
    }
    
    .tech-badges {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .nav-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .profile-image {
        width: 120px;
        height: 120px;
    }
    
    .about-header h2 {
        font-size: 24px;
    }
    
    .developer-name {
        font-size: 20px;
    }
}
