/* ====== 3Dtag Styles ====== */

/* Root Variables */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --bg-light: #f5f7fa;
    --bg-white: #ffffff;
    --text-main: #2d3748;
    --text-secondary: #718096;
    --border: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Tag colors by type */
    --tag-noun: #3b82f6;      /* 名词 - 蓝色 */
    --tag-verb: #10b981;      /* 动词 - 绿色 */
    --tag-adj: #f59e0b;       /* 形容词 - 橙色 */
    --tag-other: #9ca3af;     /* 其他 - 灰色 */
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.header-links a {
    color: white;
    font-size: 1.5rem;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.header-links a:hover {
    opacity: 1;
}

/* Main Container */
.main-container {
    display: flex;
    flex: 1;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Control Panel */
.control-panel {
    flex: 0 0 360px;
    background: var(--bg-white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 140px);
}

.control-panel h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-panel h3 {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Input Section */
.input-section textarea {
    width: 100%;
    height: 180px;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

.input-section textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.button-group {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
}

/* Settings Section */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.setting-item select {
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.stat-item {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* Search Section */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-section input {
    padding: 0.6rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.search-section input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Action Section */
.action-section {
    margin-top: auto;
}

/* Tagcloud Section */
.tagcloud-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tagcanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 1.1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.loading.hidden {
    display: none;
}

.instruction-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.75rem;
    background: var(--bg-white);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow);
}

.instruction-bar span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--error);
}

.modal-content h3 {
    margin-bottom: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.detail-value {
    color: var(--text-main);
    font-weight: 500;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    margin-left: 0.5rem;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    .control-panel {
        flex: none;
        max-height: none;
    }

    .canvas-wrapper {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .main-container {
        padding: 1rem;
    }

    .control-panel {
        padding: 1rem;
    }

    .instruction-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: center;
    }
}

/* Utility */
.hidden {
    display: none !important;
}