/* 
 * Doblesena - Juego de Dominó Venezolano
 * Estilos principales
 */

/* Variables y configuración global */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --gray-color: #95a5a6;
    --text-color: #333;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--primary-color);
}

button {
    cursor: pointer;
}

ul {
    list-style: none;
}

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

/* Header */
.main-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    height: 50px;
    width: auto;
}

.main-nav {
    flex-grow: 1;
    margin: 0 2rem;
}

.nav-list {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.nav-link {
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed);
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.username {
    font-weight: bold;
}

.user-level {
    font-size: 0.8rem;
    opacity: 0.8;
}

.auth-buttons {
    display: flex;
    gap: 0.5rem;
}

.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 0.5rem 0;
    min-width: 150px;
    z-index: 100;
    display: none;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
}

.dropdown-menu a:hover {
    background-color: var(--light-color);
}

.user-menu:hover .dropdown-menu {
    display: block;
}

.hidden {
    display: none;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 2rem;
    position: relative;
}

/* Secciones de contenido */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Botones */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: background-color var(--transition-speed), transform var(--transition-speed);
}

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

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background-color: #2980b9;
}

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

.btn-secondary:hover {
    background-color: #bdc3c7;
}

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

.btn-danger:hover {
    background-color: #c0392b;
}

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

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--box-shadow);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-color);
}

.close-modal:hover {
    color: var(--text-color);
}

/* Formularios */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

/* Lobby */
.rooms-container {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.rooms-tabs {
    display: flex;
    background-color: var(--light-color);
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.tab-btn.active {
    background-color: var(--card-background);
    border-bottom: 3px solid var(--secondary-color);
}

.tab-content {
    display: none;
    padding: 2rem;
}

.tab-content.active {
    display: block;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.room-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    transition: transform var(--transition-speed);
}

.room-card:hover {
    transform: translateY(-5px);
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.room-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.room-status.open {
    background-color: var(--success-color);
    color: white;
}

.room-status.closed {
    background-color: var(--gray-color);
    color: white;
}

.room-info {
    margin-bottom: 1.5rem;
}

.room-info p {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.room-info i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

.premium-message {
    text-align: center;
    padding: 3rem 1rem;
}

.premium-message i {
    font-size: 3rem;
    color: var(--warning-color);
    margin-bottom: 1rem;
}

/* Room Section */
.room-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.games-list h2, .room-chat h2 {
    margin-bottom: 1rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.game-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.game-status.waiting {
    background-color: var(--warning-color);
    color: white;
}

.game-status.in-progress {
    background-color: var(--secondary-color);
    color: white;
}

.game-info {
    margin-bottom: 1.5rem;
}

.game-info p {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.game-info i {
    margin-right: 0.5rem;
    color: var(--secondary-color);
}

.room-chat {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
}

.chat-message {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.message-user {
    font-weight: bold;
    margin-right: 0.5rem;
}

.message-time {
    font-size: 0.8rem;
    color: var(--gray-color);
    margin-left: 0.5rem;
}

.chat-input {
    display: flex;
    gap: 0.5rem;
}

.chat-input input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

.chat-input button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0 1rem;
    transition: background-color var(--transition-speed);
}

.chat-input button:hover {
    background-color: #2980b9;
}

/* Game Section */
.game-container {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2rem;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.game-controls {
    display: flex;
    gap: 1rem;
}

.game-board {
    background-color: #27ae60;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    position: relative;
    height: 600px;
    display: grid;
    grid-template-rows: 1fr 3fr 1fr;
    grid-template-columns: 1fr 3fr 1fr;
    grid-template-areas:
        ". top ."
        "left center right"
        ". bottom .";
}

.opponent {
    display: flex;
    align-items: center;
    padding: 1rem;
}

.opponent.top {
    grid-area: top;
    justify-content: center;
    flex-direction: column;
}

.opponent.left {
    grid-area: left;
    justify-content: flex-start;
    flex-direction: column;
}

.opponent.right {
    grid-area: right;
    justify-content: flex-end;
    flex-direction: column;
}

.current-player {
    grid-area: bottom;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.board-center {
    grid-area: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.player-info {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 0.75rem;
    border: 2px solid white;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: bold;
}

.player-level {
    font-size: 0.8rem;
    opacity: 0.8;
}

.player-tiles {
    display: flex;
    gap: 0.5rem;
}

.hidden-tiles .tile {
    background-color: #8e44ad;
    background-image: url('../images/tile-back.png');
    background-size: cover;
}

.tile {
    width: 40px;
    height: 80px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.tile:hover {
    transform: translateY(-5px);
}

.tile.rotated {
    transform: rotate(90deg);
}

.tile::before, .tile::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.tile::before {
    top: 0;
    border-bottom: 1px solid #ddd;
}

.tile::after {
    bottom: 0;
}

.tile[data-left="0"]::before, .tile[data-right="0"]::after {
    background-image: url('../images/dots-0.png');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

.tile[data-left="1"]::before, .tile[data-right="1"]::after {
    background-image: url('../images/dots-1.png');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

.tile[data-left="2"]::before, .tile[data-right="2"]::after {
    background-image: url('../images/dots-2.png');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

.tile[data-left="3"]::before, .tile[data-right="3"]::after {
    background-image: url('../images/dots-3.png');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

.tile[data-left="4"]::before, .tile[data-right="4"]::after {
    background-image: url('../images/dots-4.png');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

.tile[data-left="5"]::before, .tile[data-right="5"]::after {
    background-image: url('../images/dots-5.png');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

.tile[data-left="6"]::before, .tile[data-right="6"]::after {
    background-image: url('../images/dots-6.png');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
}

.tile.back::before, .tile.back::after {
    background-image: none;
}

.played-tiles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.game-actions {
    margin-top: 1rem;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.game-info {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
}

.score-board {
    margin-bottom: 2rem;
}

.team-score {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.turn-indicator {
    text-align: center;
}

.current-turn {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.game-chat {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Profile Section */
.profile-content {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2rem;
}

.profile-card {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.profile-header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-avatar {
    position: relative;
}

#profile-avatar-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
}

#change-avatar-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.profile-info {
    flex-grow: 1;
}

.profile-level {
    margin: 1rem 0;
}

.level-text {
    font-weight: bold;
    margin-bottom: 0.5rem;
    display: block;
}

.level-progress {
    height: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background-color: var(--secondary-color);
}

.level-stats {
    font-size: 0.8rem;
    opacity: 0.8;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.premium {
    background-color: var(--warning-color);
    color: white;
}

.status-badge.normal {
    background-color: var(--gray-color);
    color: white;
}

.profile-details {
    padding: 2rem;
}

.profile-section {
    margin-bottom: 2rem;
}

.profile-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.profile-field {
    display: flex;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.field-label {
    font-weight: 500;
    width: 150px;
}

.field-value {
    flex-grow: 1;
}

.edit-field-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    display: block;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.achievement-item {
    text-align: center;
    padding: 1rem;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    opacity: 0.5;
}

.achievement-item.unlocked {
    opacity: 1;
}

.achievement-item img {
    width: 50px;
    height: 50px;
    margin-bottom: 0.5rem;
}

.achievement-name {
    font-size: 0.8rem;
    display: block;
}

.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
}

.sidebar-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.membership-info {
    text-align: center;
}

.membership-status {
    display: block;
    margin-bottom: 1rem;
}

.status-normal {
    color: var(--gray-color);
    font-weight: 500;
}

.status-premium {
    color: var(--warning-color);
    font-weight: 500;
}

.friends-list {
    margin-bottom: 1rem;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.friend-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.friend-name {
    flex-grow: 1;
}

.friend-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.friend-status.online {
    background-color: var(--success-color);
}

.friend-status.offline {
    background-color: var(--gray-color);
}

.inventory-preview {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.inventory-item {
    width: 50px;
    height: 50px;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
}

.inventory-item img {
    max-width: 80%;
    max-height: 80%;
}

/* Footer */
.main-footer {
    background-color: var(--dark-color);
    color: white;
    padding: 2rem;
    margin-top: 2rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-logo {
    display: flex;
    align-items: center;
}

.footer-logo-img {
    height: 30px;
    margin-right: 1rem;
}

.footer-copyright {
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: white;
    opacity: 0.8;
    transition: opacity var(--transition-speed);
}

.footer-links a:hover {
    opacity: 1;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.social-link {
    color: white;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity var(--transition-speed);
}

.social-link:hover {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .profile-content {
        grid-template-columns: 1fr;
    }
    
    .game-container {
        grid-template-columns: 1fr;
    }
    
    .room-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        padding: 1rem;
    }
    
    .logo-container {
        margin-bottom: 1rem;
    }
    
    .main-nav {
        margin: 1rem 0;
        width: 100%;
    }
    
    .nav-list {
        justify-content: space-between;
        width: 100%;
    }
    
    .user-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-controls {
        margin-top: 1rem;
        width: 100%;
    }
    
    .search-container {
        width: 100%;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 576px) {
    .nav-list {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animaciones */
@keyframes tileFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg);
    }
    100% {
        transform: rotateY(180deg);
    }
}

@keyframes tileDrop {
    0% {
        transform: translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes tileShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.tile-flip {
    animation: tileFlip 0.5s forwards;
}

.tile-drop {
    animation: tileDrop 0.3s forwards;
}

.tile-shake {
    animation: tileShake 0.3s;
}

/* Efectos de hover y focus */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

/* Transiciones suaves */
.tab-content {
    transition: opacity 0.3s;
}

.content-section {
    transition: opacity 0.3s;
}
