/* =====================================================
   ОБЩИЕ СТИЛИ
   ===================================================== */

body {
    font-family: "Tahoma", "Geneva", sans-serif;
    background: #e9ebee url('https://www.transparenttextures.com/patterns/cubes.png');
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.main-container {
    max-width: 1000px;
    width: 100%;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    overflow: hidden;
}

/* =====================================================
   ШАПКА
   ===================================================== */

header {
    background: linear-gradient(to bottom, #4c66a4 0%, #3b5998 100%);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #2d4373;
}

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

a {
	color: #A2A8B5;
}

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

.logo-img {
    height: 45px;
    width: auto;
    display: block;
    border: none;
}

header h1 {
    margin: 0;
    font-size: 22px;
    text-shadow: 1px 1px 2px #000;
    letter-spacing: 0.5px;
}

.header-smiley {
    background: #fff;
    border: 1px solid #ccc;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
}

.header-smiley img {
    width: 35px;
    height: auto;
    display: block;
}

/* =====================================================
   КОНТЕНТ И СЕКЦИИ
   ===================================================== */

.content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.alert {
    background: #fff9e6;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 12px;
    font-size: 13px;
    border-radius: 4px;
}

.section {
    background: #f6f7f9;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.section h2 {
    margin-top: 0;
    font-size: 18px;
    color: #3b5998;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
    width: 100%;
}

.smiley-box {
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 4px;
}

.smiley-box img {
    width: 60px;
    height: auto;
    display: block;
}

.section-large {
    flex-direction: column;
    min-height: 500px;
}

/* =====================================================
   КНОПКИ
   ===================================================== */

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-old-school {
    display: inline-block;
    background: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%);
    border: 1px solid #999;
    padding: 5px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

/* Убегающая кнопка — инерция: стартует резко, тормозит долго */
.btn-runaway {
    position: relative;
    transition: transform 0.8s cubic-bezier(0.1, 1, 0.2, 1);
    cursor: not-allowed !important;
}

/* =====================================================
   КАНВАС (СКРИНСЕЙВЕР)
   ===================================================== */

.canvas-container {
    width: 100%;
    height: 400px;
    background: #050505;
    border-radius: 4px;
    border: 1px solid #3b5998;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
}

#proc-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* =====================================================
   СТАТУС-БАР
   ===================================================== */

.status-bar {
    background: #f0f2f5;
    padding: 10px;
    font-size: 12px;
    color: #606770;
    text-align: center;
    border-top: 1px solid #ddd;
}

/* =====================================================
   ЧАТ
   ===================================================== */

.chat-section {
    flex-direction: column;
    gap: 0;
    padding: 0;
}

.chat-header {
    background: linear-gradient(to bottom, #4c66a4 0%, #3b5998 100%);
    padding: 10px 20px;
    border-radius: 7px 7px 0 0;
    border-bottom: 3px solid #2d4373;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.chat-header h2 {
    margin: 0;
    color: #fff;
    border-bottom: none;
    padding-bottom: 0;
    font-size: 22px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
}

.chat-header h2 span {
    font-size: 14px;
    font-weight: normal;
    opacity: 0.85;
}

.chat-body {
    padding: 12px 15px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

#chat-window {
    width: 100%;
    height: 350px;
    background: #ffffff;
    border: 1px solid #dddfe2;
    border-radius: 4px;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
}

.msg {
    background: #f6f7f9;
    border: 1px solid #dddfe2;
    border-radius: 3px;
    padding: 4px 8px;
    overflow-wrap: anywhere;
    word-break: break-all;
    white-space: normal;
    max-width: 100%;
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    position: relative;
}

.msg:hover {
    background: #eef0f3;
}

/* Статусы ников */
.msg-nick {
    font-weight: bold;
    margin-right: 6px;
}

.status-online  { color: #1a7f3c !important; }
.status-offline { color: #cc2200 !important; }

/* Кнопка удаления (только для админа) */
.delete-btn {
    display: none;
    color: #ff4444;
    cursor: pointer;
    margin-left: 10px;
    font-weight: bold;
    font-family: monospace;
    font-size: 12px;
}

.msg:hover .delete-btn { display: inline; }

.auth-panel,
.chat-controls {
    width: 100%;
    display: flex;
    gap: 6px;
    box-sizing: border-box;
    flex-wrap: wrap;
}

.chat-input {
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 3px;
    padding: 5px 8px;
    font-family: "Tahoma", "Geneva", sans-serif;
    font-size: 13px;
    outline: none;
    color: #333;
}

.chat-input:focus {
    border-color: #3b5998;
    box-shadow: 0 0 0 2px rgba(59,89,152,0.15);
}

#nick-input {
    width: 130px !important;
    flex-shrink: 0;
    font-weight: bold;
    background: #f0f2f5;
    color: #3b5998;
}

.btn-logout {
    background: linear-gradient(to bottom, #ff6666 0%, #cc0000 100%) !important;
    color: #fff !important;
    border: 1px solid #900 !important;
    display: none;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.4);
}

.btn-logout:hover {
    background: linear-gradient(to bottom, #ff4444 0%, #aa0000 100%) !important;
}

/* =====================================================
   ХОЛСТ ДЛЯ РИСОВАНИЯ
   ===================================================== */

.canvas-section {
    flex-direction: column;
    gap: 0;
    padding: 0;
}

.canvas-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* Тулбар */
.draw-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 12px;
    background: #f0f2f5;
    border-bottom: 1px solid #dddfe2;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.toolbar-label {
    font-size: 12px;
    color: #606770;
    white-space: nowrap;
}

.tool-btn {
    font-size: 16px;
    padding: 4px 8px;
    min-width: 34px;
    text-align: center;
}

.tool-btn.active {
    background: linear-gradient(to bottom, #c8d8f8 0%, #a0b8f0 100%);
    border-color: #3b5998;
    color: #1a3a7a;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}

input[type="color"] {
    width: 34px;
    height: 28px;
    border: 1px solid #999;
    border-radius: 3px;
    cursor: pointer;
    padding: 1px;
    background: #fff;
}

input[type="range"] {
    width: 90px;
    cursor: pointer;
    accent-color: #3b5998;
}

.btn-danger {
    background: linear-gradient(to bottom, #ff6666 0%, #cc0000 100%) !important;
    color: #fff !important;
    border-color: #900 !important;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.btn-danger:hover {
    background: linear-gradient(to bottom, #ff4444 0%, #aa0000 100%) !important;
}

/* Обёртка холста */
.draw-canvas-wrap {
    width: 100%;
    height: 480px;
    background: #fff;
    position: relative;
    overflow: hidden;
}

#draw-canvas {
    display: block;
    width: 100%;
    height: 100%;
}
