:root {
    --excel-green: #217346;
    --excel-dark-green: #185c37;
    --excel-light-green: #33c481;
    --ribbon-bg: #f3f3f3;
    --cell-border: #d4d4d4;
    --cell-selected: #c6e0b4;
    --header-bg: #f0f0f0;
    --text-color: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.excel-body {
    font-family: 'Segoe UI', 'Malgun Gothic', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    background-color: #e6e6e6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.excel-menubar {
    background-color: var(--excel-green);
    color: white;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.excel-icon {
    font-size: 14px;
    font-weight: bold;
    background: white;
    color: var(--excel-green);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.excel-title {
    flex: 1;
}

.connection-status {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
}

.user-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    margin-left: 5px;
}

.notification-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 14px;
    margin-left: 5px;
    cursor: pointer;
    color: white;
    transition: background 0.2s, opacity 0.2s;
}

.notification-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.notification-toggle.off {
    opacity: 0.5;
}

.notification-toggle.off .notification-icon {
    text-decoration: line-through;
}

/* 윈도우 컨트롤 버튼 (최소화, 최대화, 닫기) */
.window-controls {
    display: flex;
    margin-left: 10px;
}

.window-btn {
    width: 46px;
    height: 30px;
    border: none;
    background: transparent;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s;
}

.window-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.window-btn.close:hover {
    background: #e81123;
}

.window-btn.close:active {
    background: #bf0f1d;
}

/* 더미 모드 안내 배너 */
.dummy-mode-banner {
    background: #fff3cd;
    color: #856404;
    padding: 8px 15px;
    text-align: center;
    font-size: 12px;
    border-bottom: 1px solid #ffc107;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 더미 데이터 영역 */
.dummy-data-area {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.connection-status.connected {
    background: var(--excel-light-green);
}

.connection-status.disconnected {
    background: #d32f2f;
}

.excel-ribbon {
    background: var(--ribbon-bg);
    border-bottom: 1px solid var(--cell-border);
    display: flex;
    padding: 0 10px;
}

.ribbon-tab {
    padding: 8px 15px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    color: var(--text-color);
    user-select: none;
}

.ribbon-tab:hover {
    background: #e5e5e5;
}

.ribbon-tab.active {
    border-bottom-color: var(--excel-green);
    background: white;
}

.excel-formula-bar {
    display: flex;
    align-items: center;
    background: white;
    border-bottom: 1px solid var(--cell-border);
    padding: 4px 5px;
    gap: 5px;
}

.cell-name {
    background: var(--header-bg);
    border: 1px solid var(--cell-border);
    padding: 4px 10px;
    min-width: 60px;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.formula-icon {
    padding: 4px 8px;
    border-left: 1px solid var(--cell-border);
    border-right: 1px solid var(--cell-border);
    color: #666;
    font-style: italic;
}

.formula-input {
    flex: 1;
    border: none;
    padding: 6px;
    font-size: 12px;
    outline: none;
    font-family: inherit;
}

.formula-input:focus {
    background: #fff9e6;
}

.send-button {
    background: var(--excel-green);
    color: white;
    border: none;
    padding: 6px 15px;
    cursor: pointer;
    font-size: 11px;
    border-radius: 2px;
}

.send-button:hover {
    background: var(--excel-dark-green);
}

.send-button:active {
    transform: scale(0.98);
}

.excel-sheet {
    flex: 1;
    background: white;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-sheet {
    background: white;
}

.excel-header-row {
    display: flex;
    background: var(--header-bg);
    border-bottom: 1px solid var(--cell-border);
    flex-shrink: 0;
}

.excel-header-row.labels {
    background: #e2efda;
    font-weight: 600;
}

.excel-cell {
    border-right: 1px solid var(--cell-border);
    padding: 6px 8px;
    text-align: center;
}

.excel-cell.header {
    background: var(--header-bg);
}

.excel-cell.col-a {
    width: 80px;
    flex-shrink: 0;
}

.excel-cell.col-b {
    width: 120px;
    flex-shrink: 0;
}

.excel-cell.col-c {
    flex: 1;
    text-align: left;
}

.message-area {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 10px;
}

.message-row {
    display: flex;
    border-bottom: 1px solid var(--cell-border);
    min-height: 28px;
}

.message-row:hover {
    background: #f5f5f5;
}

.message-row.system {
    background: #fff2cc;
}

.message-row.system:hover {
    background: #ffecb3;
}

.message-row.mine {
    background: #e2efda;
}

.message-row.mine:hover {
    background: #d4e8cb;
}

.msg-time {
    width: 80px;
    color: #666;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-right: 1px solid var(--cell-border);
    padding: 4px;
}

.msg-sender {
    width: 120px;
    font-weight: 500;
    color: var(--excel-dark-green);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-right: 1px solid var(--cell-border);
    padding: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-content {
    flex: 1;
    text-align: left;
    word-break: break-word;
    padding: 6px 8px;
    line-height: 1.4;
}

.login-cell {
    background: white;
    border: 2px solid var(--excel-green);
    margin: 50px auto;
    padding: 30px;
    max-width: 400px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.cell-header {
    background: var(--excel-green);
    color: white;
    padding: 10px;
    margin: -30px -30px 20px -30px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.cell-row {
    margin-bottom: 15px;
}

.cell-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.cell-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--cell-border);
    font-size: 14px;
    font-family: inherit;
}

.cell-input:focus {
    border-color: var(--excel-green);
    outline: none;
    box-shadow: 0 0 0 2px rgba(33, 115, 70, 0.2);
}

.excel-button {
    width: 100%;
    background: var(--excel-green);
    color: white;
    border: none;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    border-radius: 2px;
}

.excel-button:hover {
    background: var(--excel-dark-green);
}

.excel-button:active {
    transform: scale(0.99);
}

.excel-sheet-tabs {
    display: flex;
    background: #e6e6e6;
    border-top: 1px solid var(--cell-border);
    padding: 5px 10px;
    flex-shrink: 0;
}

.sheet-tab {
    background: #f0f0f0;
    border: 1px solid var(--cell-border);
    border-bottom: none;
    padding: 5px 15px;
    margin-right: 2px;
    cursor: pointer;
    font-size: 11px;
    user-select: none;
}

.sheet-tab:hover {
    background: #e5e5e5;
}

.sheet-tab.active {
    background: white;
    border-bottom: 1px solid white;
    margin-bottom: -1px;
}

/* Tablet */
@media (max-width: 768px) {
    .ribbon-tab {
        padding: 6px 10px;
        font-size: 11px;
    }

    .excel-cell.col-b,
    .msg-sender {
        width: 80px;
    }

    .cell-name {
        min-width: 50px;
        padding: 4px 6px;
    }

    .login-cell {
        margin: 30px 20px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .excel-ribbon {
        display: none;
    }

    .hidden-mobile {
        display: none;
    }

    .excel-cell.col-a,
    .msg-time {
        width: 55px;
    }

    .excel-cell.col-b,
    .msg-sender {
        width: 60px;
        font-size: 10px;
    }

    .msg-time {
        font-size: 9px;
    }

    .msg-content {
        font-size: 11px;
        padding: 4px 6px;
    }

    .login-cell {
        margin: 20px 10px;
        padding: 20px;
    }

    .cell-header {
        margin: -20px -20px 15px -20px;
    }

    .excel-title {
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .send-button {
        padding: 6px 10px;
        font-size: 10px;
    }

    .formula-input {
        font-size: 14px;
    }

    .cell-name {
        max-width: 60px;
        font-size: 10px;
    }

    .sheet-tab {
        padding: 4px 10px;
        font-size: 10px;
    }
}

/* Scrollbar styling */
.message-area::-webkit-scrollbar {
    width: 12px;
}

.message-area::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.message-area::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border: 2px solid #f1f1f1;
}

.message-area::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 더미 엑셀 데이터 스타일 */
.dummy-row {
    display: flex;
    border-bottom: 1px solid var(--cell-border);
    min-height: 24px;
}

.dummy-row:nth-child(even) {
    background: #fafafa;
}

.dummy-row:hover {
    background: #e8f4fd;
}

.dummy-row.selected {
    background: var(--cell-selected);
}

.dummy-cell {
    border-right: 1px solid var(--cell-border);
    padding: 4px 8px;
    font-size: 11px;
    display: flex;
    align-items: center;
}

.dummy-cell.row-num {
    width: 40px;
    background: var(--header-bg);
    justify-content: center;
    color: #666;
    flex-shrink: 0;
}

.dummy-cell.col-a {
    width: 100px;
    flex-shrink: 0;
}

.dummy-cell.col-b {
    width: 150px;
    flex-shrink: 0;
}

.dummy-cell.col-c {
    width: 120px;
    flex-shrink: 0;
    text-align: right;
    justify-content: flex-end;
}

.dummy-cell.col-d {
    width: 100px;
    flex-shrink: 0;
    text-align: center;
    justify-content: center;
}

.dummy-cell.col-e {
    flex: 1;
}

.dummy-cell.number {
    font-family: 'Consolas', 'Courier New', monospace;
    color: #1a73e8;
}

.dummy-cell.negative {
    color: #d32f2f;
}

.dummy-cell.formula {
    color: #2e7d32;
}

/* 더미 데이터 헤더 */
.dummy-header-row {
    display: flex;
    background: var(--header-bg);
    border-bottom: 1px solid var(--cell-border);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.dummy-header-row .dummy-cell {
    background: var(--header-bg);
}
