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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #000000;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: rgba(20, 20, 20, 0.95);
    border-right: 1px solid rgba(255, 85, 0, 0.2);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 30px 20px 20px;
    border-bottom: 1px solid rgba(255, 85, 0, 0.2);
}

.sidebar-header h2 {
    color: #ff5500;
    font-size: 1.3em;
    font-weight: 600;
    margin: 0;
    margin-bottom: 12px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #ff5500 0%, #cc4400 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(255, 85, 0, 0.3);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.sheet-tabs {
    display: flex;
    flex-direction: column;
    padding: 20px 15px;
    gap: 8px;
}

.sheet-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    color: #b0b0b0;
    border: 2px solid transparent;
    padding: 16px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
    text-align: left;
    width: 100%;
    position: relative;
}

.sheet-tab:hover {
    background: rgba(255, 85, 0, 0.1);
    color: white;
    border-color: rgba(255, 85, 0, 0.3);
    transform: translateX(5px);
}

.sheet-tab.active {
    background: rgba(255, 85, 0, 0.2);
    color: white;
    border-color: #ff5500;
    box-shadow: 0 0 20px rgba(255, 85, 0, 0.3);
}

.tab-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.tab-text {
    flex: 1;
}

main {
    display: flex;
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

.main-container {
    display: flex;
    gap: 20px;
    width: 100%;
    height: 100%;
}

/* Data Overview Panel */
.data-overview-panel {
    flex: 0 0 400px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(255, 85, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 85, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid rgba(255, 85, 0, 0.1);
}

.panel-header h3 {
    margin: 0;
    color: #ff5500;
    font-size: 1.2em;
}

.refresh-btn {
    background: none;
    border: 2px solid #ff5500;
    color: #ff5500;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.refresh-btn:hover {
    background: #ff5500;
    color: white;
    transform: rotate(180deg);
}

.data-overview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #666;
}

.loading-container p {
    margin-top: 15px;
    font-size: 14px;
}

/* Data Overview Sections */
.overview-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.overview-section:last-child {
    border-bottom: none;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    color: #ff5500;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.metric-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.metric-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    color: #ff5500;
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    margin: 0;
    height: 100%;
    overflow-y: auto;
}

.column-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    color: #444;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.column-item:hover {
    background: #f0f1f3;
    border-color: #ff5500;
    transform: translateX(2px);
}

.column-number {
    font-size: 11px;
    color: #999;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 30px;
    text-align: center;
    font-weight: 500;
}

.column-name {
    flex: 1;
    font-size: 13px;
    color: #333;
    word-break: break-word;
}

.chart-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    margin-top: 10px;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-label {
    font-size: 13px;
    color: #666;
    min-width: 60px;
    text-align: right;
}

.chart-bar-container {
    flex: 1;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.chart-bar {
    height: 100%;
    background: linear-gradient(135deg, #ff5500 0%, #cc4400 100%);
    transition: width 0.5s ease;
}

.chart-value {
    font-size: 12px;
    color: #444;
    margin-left: 8px;
    min-width: 50px;
}

.chat-container {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(255, 85, 0, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 85, 0, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 15px;
    word-wrap: break-word;
}

.user-message .message-content {
    background: linear-gradient(135deg, #ff5500 0%, #cc4400 100%);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 10px rgba(255, 85, 0, 0.3);
}

.bot-message .message-content {
    background-color: #f8f9fa;
    color: #000000;
    border-bottom-left-radius: 5px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.input-container {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 2px solid rgba(255, 85, 0, 0.1);
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

#user-input:focus {
    border-color: #ff5500;
    box-shadow: 0 0 0 3px rgba(255, 85, 0, 0.1);
}

#send-button {
    background: linear-gradient(135deg, #ff5500 0%, #cc4400 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 85, 0, 0.3);
}

#send-button:hover {
    background: linear-gradient(135deg, #cc4400 0%, #ff5500 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 85, 0, 0.4);
}

#send-button:active {
    transform: scale(0.95);
}

.info-panel {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    height: fit-content;
}

.info-panel h3 {
    margin-bottom: 15px;
    color: #ff5500;
}

.info-panel p {
    margin-bottom: 10px;
    font-size: 0.9em;
}

.info-panel code {
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    word-break: break-all;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-radius: 50%;
    border-top: 3px solid #ff5500;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Add Data Button */
.add-data-btn {
    background: linear-gradient(135deg, #ff5500 0%, #cc4400 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 85, 0, 0.3);
    transition: all 0.3s;
}

/* Sidebar-specific add button */
.sidebar-add-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    background: rgba(255, 85, 0, 0.1);
    color: #ff5500;
    border: 2px dashed rgba(255, 85, 0, 0.3);
    box-shadow: none;
}

.sidebar-add-btn:hover {
    background: rgba(255, 85, 0, 0.2);
    border-color: #ff5500;
    transform: none;
    box-shadow: 0 2px 10px rgba(255, 85, 0, 0.2);
}

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: #ffffff;
    margin: 10% auto;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, #ff5500 0%, #cc4400 100%);
    padding: 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: white;
    font-size: 22px;
    font-weight: 600;
}

.close {
    color: white;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.close:hover,
.close:focus {
    opacity: 1;
}

.modal-body {
    padding: 30px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 15px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: #ff5500;
    box-shadow: 0 0 0 3px rgba(255, 85, 0, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 13px;
}

/* Data Type Buttons */
.data-type-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #f8f8f8;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
}

.type-btn:hover {
    border-color: #ff5500;
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 85, 0, 0.1);
}

.type-btn.active {
    border-color: #ff5500;
    background: #fff5f2;
    box-shadow: 0 2px 10px rgba(255, 85, 0, 0.2);
}

.type-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.type-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.type-desc {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 32px;
}

/* Form buttons in modals without delete button */
#add-data-modal .form-buttons {
    justify-content: flex-end;
}

/* Form buttons wrapper for cancel and submit */
#edit-data-modal .form-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Delete button on the left */
#edit-data-modal .btn-delete {
    margin-right: auto;
}

/* Group cancel and submit buttons together on the right */
#edit-data-modal .btn-cancel {
    margin-left: auto;
}

#edit-data-modal .btn-submit {
    margin-left: 12px;
}

.btn-cancel,
.btn-submit {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-cancel {
    background-color: #f0f0f0;
    color: #666;
}

.btn-cancel:hover {
    background-color: #e0e0e0;
}

.btn-submit {
    background: linear-gradient(135deg, #ff5500 0%, #cc4400 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 85, 0, 0.3);
}

.btn-submit:hover {
    background: linear-gradient(135deg, #cc4400 0%, #ff5500 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 85, 0, 0.4);
}

.btn-delete {
    padding: 12px 24px;
    border: 2px solid #dc3545;
    border-radius: 12px;
    background-color: #fff;
    color: #dc3545;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: inline-block;
}

.btn-delete:hover {
    background-color: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}


/* 모바일 반응형 */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid rgba(255, 85, 0, 0.2);
    }
    
    .sidebar-header {
        padding: 20px 15px 10px;
    }
    
    .sheet-tabs {
        flex-direction: row;
        padding: 10px 15px;
        overflow-x: auto;
        gap: 10px;
    }
    
    .sheet-tab {
        padding: 10px 16px;
        white-space: nowrap;
        min-width: fit-content;
    }
    
    .sheet-tab:hover {
        transform: translateY(-2px);
    }
    
    .tab-icon {
        display: none;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    header {
        padding: 20px 15px;
    }
    
    main {
        padding: 15px;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .data-overview-panel {
        flex: 0 0 auto;
        height: 300px;
        width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .add-data-btn {
        top: 10px;
        right: 10px;
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Edit button styles for data source titles */
.sheet-tab .edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: auto;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.sheet-tab .edit-btn:hover {
    color: #ff5500;
}

/* Delete button styles for data source titles */
.sheet-tab .delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #dc3545;
    transition: color 0.2s;
    padding: 0;
    flex-shrink: 0;
    font-size: 14px;
}

.sheet-tab .delete-btn:hover {
    color: #ff0000;
    transform: scale(1.1);
}

/* Hide unused inline edit elements */
.sheet-tab .edit-input,
.sheet-tab .save-btn,
.sheet-tab .cancel-btn {
    display: none !important;
}

/* Web search results styles */
.web-search-results {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.web-search-results h4 {
    margin: 0 0 15px 0;
    color: #1a73e8;
    font-size: 16px;
    font-weight: 600;
}

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

.search-result-item {
    padding: 10px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-result-item a {
    color: #1a73e8;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
}

.search-result-item a:hover {
    text-decoration: underline;
}

.search-source {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}
