/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #e2e8f0;
}

/* ==================== CONTAINER ==================== */
#game-container {
    background: #2d3748;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 1000px;
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ==================== TELA INICIAL ==================== */
#start-screen {
    text-align: center;
    padding: 30px;
}

#start-screen .logo {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#start-screen h1 {
    font-size: 2.5rem;
    color: #ff6b35;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

#start-screen .subtitle {
    color: #a0aec0;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

#start-screen .instructions {
    background: #1a202c;
    padding: 25px;
    border-radius: 15px;
    text-align: left;
    margin-bottom: 25px;
}

#start-screen .instructions h3 {
    color: #ff6b35;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

#start-screen .instructions p {
    color: #cbd5e0;
    line-height: 1.6;
    margin-bottom: 10px;
}

.rules {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #4a5568;
}

.rules h4 {
    color: #ffd93d;
    margin-bottom: 15px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
}

.task-item.blue {
    border-left: 4px solid #4299e1;
}

.task-item.red {
    border-left: 4px solid #fc8181;
}

.task-item.green {
    border-left: 4px solid #68d391;
}

.task-icon {
    font-size: 1.5rem;
}

.task-info {
    display: flex;
    flex-direction: column;
}

.task-info strong {
    color: #e2e8f0;
}

.task-info span {
    color: #a0aec0;
    font-size: 0.85rem;
}

.warnings {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 107, 53, 0.3);
}

.warnings p {
    margin-bottom: 8px !important;
    font-size: 0.95rem;
}

.warnings p:last-child {
    margin-bottom: 0 !important;
}

#start-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    padding: 18px 60px;
    font-size: 1.3rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.4);
}

/* ==================== HEADER DO JOGO ==================== */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #1a202c;
    border-radius: 12px;
    gap: 20px;
}

#timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.timer-icon {
    font-size: 1.5rem;
}

#timer {
    font-size: 2rem;
    font-weight: bold;
    color: #48bb78;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(72, 187, 120, 0.5);
}

#timer.warning {
    color: #ed8936;
    text-shadow: 0 0 10px rgba(237, 137, 54, 0.5);
}

#timer.danger {
    color: #f56565;
    text-shadow: 0 0 10px rgba(245, 101, 101, 0.5);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#phase-indicator {
    background: rgba(255, 107, 53, 0.2);
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid #ff6b35;
}

#phase-text {
    color: #ff6b35;
    font-weight: bold;
    font-size: 0.95rem;
}

#progress-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#progress-text {
    font-size: 0.9rem;
    color: #a0aec0;
}

#progress-text span {
    color: #ffd93d;
    font-weight: bold;
}

#progress-bar {
    width: 150px;
    height: 8px;
    background: #4a5568;
    border-radius: 4px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #48bb78, #68d391);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* ==================== ÁREA DO ESCRITÓRIO ==================== */
#office {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.area {
    background: #4a5568;
    border-radius: 12px;
    padding: 15px;
    position: relative;
}

.area-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.area-icon {
    font-size: 1.3rem;
}

.area-title {
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
}

.area-count {
    font-size: 0.85rem;
    color: #a0aec0;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 12px;
    border-radius: 12px;
}

.area-hint {
    text-align: center;
    color: #718096;
    font-size: 0.8rem;
    margin-top: 10px;
    font-style: italic;
}

/* Recepção */
#reception {
    background: linear-gradient(135deg, #553c9a 0%, #6b46c1 100%);
    border: 2px solid #805ad5;
}

#reception .slots-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 90px;
    align-items: flex-start;
    align-content: flex-start;
}

/* Sala de Espera */
#waiting-room {
    background: linear-gradient(135deg, #744210 0%, #975a16 100%);
    border: 2px solid #d69e2e;
}

#waiting-room .slots-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 90px;
    align-items: flex-start;
    align-content: flex-start;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* Espaços de Trabalho */
#workspaces {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
}

.workspace {
    background: #4a5568;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
}

.workspace-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.workspace-icon {
    font-size: 1.3rem;
}

.workspace-title {
    font-weight: bold;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.workspace-slots {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Open Space */
#open-space {
    background: linear-gradient(135deg, #2b6cb0 0%, #3182ce 100%);
    border: 2px solid #4299e1;
}

/* Phonebooth */
#phonebooth {
    background: linear-gradient(135deg, #c53030 0%, #e53e3e 100%);
    border: 2px solid #fc8181;
}

/* Huddle Room */
#huddle-room {
    background: linear-gradient(135deg, #276749 0%, #38a169 100%);
    border: 2px solid #68d391;
}

/* Slots de Trabalho */
.work-slot {
    width: 90px;
    height: 110px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.3s ease;
}

.work-slot.highlight {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
    border-style: solid;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.work-slot.invalid {
    background: rgba(255, 0, 0, 0.3);
    border-color: #f56565;
    border-style: solid;
}

.work-slot.occupied {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.6);
}

.slot-label {
    position: absolute;
    bottom: 8px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slot-timer {
    position: absolute;
    bottom: -25px;
    left: 5px;
    right: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.slot-timer-bar {
    width: 100%;
    height: 6px;
    background: #1a202c;
    border-radius: 3px;
    overflow: hidden;
}

.slot-timer-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: var(--progress, 100%);
    background: linear-gradient(90deg, #ffd93d, #48bb78);
    transition: width 0.1s linear;
    border-radius: 3px;
}

.slot-timer-text {
    font-size: 0.7rem;
    color: #ffd93d;
    font-weight: bold;
}

/* ==================== FUNCIONÁRIOS ==================== */
.employee {
    width: 65px;
    height: 80px;
    border-radius: 10px;
    cursor: grab;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.employee:hover {
    transform: scale(1.05);
}

.employee.dragging {
    cursor: grabbing;
    transform: scale(1.15);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0.95;
}

.employee.working {
    cursor: default;
    animation: working-pulse 2s ease-in-out infinite;
}

@keyframes working-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 4px 25px rgba(255, 217, 61, 0.4); }
}

.employee.blue {
    background: linear-gradient(135deg, #2b6cb0 0%, #4299e1 100%);
    border: 3px solid #63b3ed;
}

.employee.red {
    background: linear-gradient(135deg, #c53030 0%, #fc8181 100%);
    border: 3px solid #feb2b2;
}

.employee.green {
    background: linear-gradient(135deg, #276749 0%, #48bb78 100%);
    border: 3px solid #9ae6b4;
}

.employee-icon {
    font-size: 1.6rem;
    margin-bottom: 3px;
}

.employee-name {
    font-size: 0.6rem;
    color: white;
    text-align: center;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    max-width: 55px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.employee-task {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

/* Barra de Paciência */
.patience-container {
    position: absolute;
    top: -10px;
    left: 5px;
    right: 5px;
    height: 6px;
    background: #1a202c;
    border-radius: 3px;
    overflow: hidden;
}

.patience-bar {
    height: 100%;
    background: linear-gradient(90deg, #f56565 0%, #48bb78 100%);
    transition: width 0.1s linear;
    border-radius: 3px;
}

.patience-bar.low {
    background: linear-gradient(90deg, #f56565 0%, #ed8936 100%);
    animation: blink 0.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== OVERLAY DE MENSAGEM ==================== */
#message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#message-box {
    background: #2d3748;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 450px;
    width: 90%;
}

#message-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

#message-box h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

#message-box.victory h2 {
    color: #48bb78;
}

#message-box.defeat h2 {
    color: #f56565;
}

#message-box p {
    color: #a0aec0;
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.5;
}

#message-stats {
    background: #1a202c;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
}

#message-stats p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

#message-stats p:last-child {
    margin-bottom: 0;
}

#restart-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

#restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(255, 107, 53, 0.4);
}

/* ==================== TOAST ==================== */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #e53e3e;
    color: white;
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 3000;
    transition: transform 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    font-size: 0.95rem;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
}

#toast.success {
    background: #48bb78;
}

#toast.warning {
    background: #ed8936;
}

/* ==================== TOOLTIP DE ERRO ==================== */
#error-tooltip {
    position: fixed;
    background: #e53e3e;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: bold;
    z-index: 2500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* ==================== RESPONSIVIDADE ==================== */
@media (max-width: 768px) {
    #game-container {
        padding: 15px;
    }

    #header {
        flex-direction: column;
        gap: 10px;
    }

    #workspaces {
        grid-template-columns: 1fr;
    }

    .workspace-slots {
        justify-content: center;
    }

    #timer {
        font-size: 1.5rem;
    }

    .employee {
        width: 55px;
        height: 70px;
    }

    .work-slot {
        width: 75px;
        height: 95px;
    }
}
