/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    height: 100%;
    font-family: 'Inter', sans-serif;
    overflow: hidden; /* Prevents scrolling to keep the "app" feel */
}

/* Header Styling */
.main-header {
    height: 80px;
    width: 100%;
    background: linear-gradient(180deg, #2b2b2b 0%, #1a1a1a 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 10;
    position: relative;
    border-bottom: 1px solid #333;
}

.logo-area h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #e0e0e0;
    letter-spacing: 0.5px;
}

/* Button Styling */
.btn {
    padding: 10px 28px;
    border-radius: 25px; /* More curved */
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    
    /* Animation Basics */
    background-size: 200% auto; /* Makes gradient larger than button for movement */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); /* Smooth 'bouncy' ease */
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    
    /* Base border - subtle */
    border: 1px solid rgba(255, 255, 255, 0.1); 
}

/* Hover Effect for ALL buttons */
.btn:hover {
    background-position: right center; /* Moves the gradient */
    transform: translateY(-2px); /* Lifts up slightly */
}

/* Active/Click Effect */
.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Primary (Login) - Blue Tone */
.btn.primary {
    /* 3-Stop Gradient: Dark Blue -> Lighter Blue -> Dark Blue */
    background-image: linear-gradient(to right, #2c3e50 0%, #4ca1af 51%, #2c3e50 100%);
    color: white;
}

.btn.primary:hover {
    /* Blueish Glow */
    box-shadow: 0 0 15px rgba(76, 161, 175, 0.6); 
    border-color: rgba(76, 161, 175, 0.8);
}

/* Secondary (Register) - Silver/White Tone */
.btn.secondary {
    /* 3-Stop Gradient: Grey -> White -> Grey */
    background-image: linear-gradient(to right, #8e9eab 0%, #eef2f3 51%, #8e9eab 100%);
    color: #333;
}

.btn.secondary:hover {
    /* White Glow */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5); 
    border-color: #fff;
}
/* Main Room Styling */
.meeting-room {
    /* Calculate height minus header to fill the screen */
    height: calc(100vh - 80px); 
    width: 100%;
    background-color: #333; /* Fallback color */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}


.header-logo {
    max-height: 60px; /* Fits comfortably inside the 80px header */
    width: auto;      /* Maintains aspect ratio */
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); /* Adds a subtle pop against the dark header */
}

/* --- VIEW STATES --- */
.view-section {
    width: 100%;
    height: calc(100vh - 80px);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    position: relative;
}

.view-section.active {
    display: flex;
}

/* Landing View */
.landing-message {
    text-align: center;
    color: #666;
}

.landing-message h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Dashboard View */
#dashboard-view {
    background-color: #f4f4f4;
    align-items: flex-start;
    padding: 40px;
}
.dashboard-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}
.lobby-controls { margin: 20px 0; }
.lobby-placeholder {
    padding: 40px;
    background: white;
    border-radius: 8px;
    text-align: center;
    color: #999;
    border: 1px dashed #ccc;
}

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}
.modal-overlay.hidden { display: none; }

.modal-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-modal {
    position: absolute;
    top: 10px; right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

/* Form Styles */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; color: #333; }
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.error-msg { color: #e74c3c; font-size: 0.9rem; margin-bottom: 10px; display: none;}

/* --- HEADER PROFILE --- */
.profile-widget {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px; /* Space between name and image */
    padding: 5px 15px 5px 15px; /* Added padding left/right for better click area */
    border-radius: 30px;
    transition: background 0.2s;
}

.profile-widget:hover {
    background: rgba(255, 255, 255, 0.1); /* Subtle highlight on hover */
}

.profile-name { 
    font-weight: 600; 
    color: white; 
    font-size: 1rem;
    user-select: none; /* Prevents text selection when clicking */
}

.profile-img {
    width: 50px;       /* Larger size */
    height: 50px;      /* Fixed height */
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    object-fit: cover; /* Forces center-crop */
    background-color: #ccc; 
    display: block;    
}

/* --- DROPDOWN MENU --- */
.profile-dropdown {
    /* Base Styles (restored) */
    position: absolute;
    background: white;
    border-radius: 8px;
    width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    display: none;       /* Hidden by default */
    overflow: hidden;
    flex-direction: column;
    z-index: 100;
    
    /* Positioning Tweaks */
    top: 70px;          /* Pushed down below the header */
    right: 0;           /* Aligns to the right edge of the widget */
}

/* Show the dropdown when the widget has the 'active' class */
.profile-widget.active .profile-dropdown { 
    display: flex; 
}

.dropdown-item {
    padding: 12px 20px;
    color: #333;
    cursor: pointer;    /* Ensures hand cursor appears */
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover { 
    background: #f5f5f5; 
}

.dropdown-item.danger { 
    color: #e74c3c; 
}

.dropdown-item.danger:hover { 
    background: #ffe6e6; 
}

/* Lobby List Styling */
.lobby-list {
    width: 100%;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lobby-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 5px solid #4ca1af; /* Blue accent */
}

.lobby-info h3 {
    margin: 0 0 5px 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lobby-role {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}
.lobby-role.chairman { background: #2c3e50; color: white; }
.lobby-role.member { background: #ecf0f1; color: #7f8c8d; }

.lobby-code { font-family: monospace; color: #666; font-size: 0.9rem; }

.lobby-actions { display: flex; align-items: center; gap: 15px; }

.btn.small { padding: 8px 16px; font-size: 0.8rem; }

.btn-delete {
    background: none; border: none;
    color: #e74c3c; font-size: 1.5rem;
    cursor: pointer; line-height: 1;
    transition: transform 0.2s;
}
.btn-delete:hover { transform: scale(1.2); color: #c0392b; }

/* --- STRICT MEETING ROOM STYLES --- */

.room-container {
    width: 100%;
    height: 100%;
    
    /* Background Image Settings */
    background-image: url('../images/background.jpg'); 
    background-size: contain; 
    background-position: center center; 
    background-repeat: no-repeat;
    background-color: #2b2b2b; 
    
    /* Coordinate System Settings */
    position: relative;
    overflow: hidden; /* Prevents scrolling if avatars get big */
}

/* The invisible box for the chair */
.chair-zone {
    position: absolute;
    width: 60px !important;  /* Force width */
    height: 60px !important; /* Force height */
    transform: translate(-50%, -50%);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Hover effect for EMPTY chairs only */
.chair-zone:not(.occupied):hover {
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* The User's Image */
.chair-zone .avatar {
    width: 60px !important;  /* Force width */
    height: 60px !important; /* Force height */
    border-radius: 50%;
    object-fit: cover;       /* Crops the image to fit the circle perfectly */
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    display: block;
    pointer-events: none;    /* Lets clicks pass through to the div */
}

/* Highlight "Me" */
.chair-zone.is-me .avatar {
    border-color: #4ca1af;
    box-shadow: 0 0 15px #4ca1af;
}

/* Tooltip (Name or 'Sit Here') */
.chair-tooltip {
    position: absolute;
    top: -40px; /* Moves it ABOVE the chair */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden; /* Hides it completely when not hovering */
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 200;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Show tooltip on hover */
.chair-zone:hover .chair-tooltip {
    opacity: 1;
    visibility: visible;
    top: -45px; /* Slight float up animation */
}
a.btn {
    text-decoration: none;
}