/* ===================================
   法律AI助手 - 法律主题样式表
   现代简洁 + 法律专业感
   =================================== */

/* CSS Variables */
:root {
    --primary: #1B3A5C;
    --primary-dark: #12293F;
    --primary-light: #2C5282;
    --secondary: #64748b;
    --accent: #E67E22;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

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

.logo-icon {
    font-size: 36px;
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-text p {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.powered {
    font-size: 12px;
    color: var(--text-muted);
}

/* Main */
.main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Section */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.section-title .icon {
    font-size: 20px;
}

.section-title h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Input Section */
.input-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.textarea-wrapper {
    position: relative;
}

.textarea-wrapper textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

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

.textarea-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.textarea-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.char-count {
    font-size: 12px;
    color: var(--text-muted);
}

.button-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
    border-color: #475569;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--secondary);
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* Status Section */
.status-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.status-card {
    text-align: center;
}

.status-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.status-icon {
    font-size: 40px;
}

.status-info {
    text-align: left;
}

.status-text {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-detail {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
    animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Result Section */
.result-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.result-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* Report Container */
.report-container {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.8;
}

.report-container pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
}

/* Error Section */
.error-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.error-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.error-icon {
    font-size: 36px;
}

.error-info {
    flex: 1;
}

.error-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--danger);
}

.error-message {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.modal-backdrop {
    position: absolute;
    background: rgba(0,0,0,0.5);
    width: 100%;
    height: 100%;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

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

.modal-body {
    padding: 16px 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.example-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-item:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.example-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.example-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 12px;
}

.footer p {
    margin-bottom: 4px;
}

/* Loading Animation */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ===================================
   响应式布局 - 设备自适应
   =================================== */

/* 桌面端 (PC) - 默认样式 */
body.is-desktop .container {
    max-width: 900px;
}

body.is-desktop .header {
    flex-direction: row;
    padding: 20px 24px;
}

body.is-desktop .logo {
    flex-direction: row;
}

body.is-desktop .textarea-wrapper textarea {
    min-height: 140px;
}

body.is-desktop .button-row {
    flex-direction: row;
}

body.is-desktop .btn {
    min-width: 120px;
}

/* 平板端 (Tablet) */
body.is-tablet .container {
    max-width: 720px;
}

body.is-tablet .header {
    flex-direction: row;
    padding: 16px 20px;
}

body.is-tablet .textarea-wrapper textarea {
    min-height: 120px;
}

body.is-tablet .button-row {
    flex-wrap: wrap;
}

body.is-tablet .btn {
    min-width: 100px;
}

/* 手机端 (Phone) */
body.is-phone .container {
    padding: 10px;
}

body.is-phone .header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 14px 16px;
}

body.is-phone .logo {
    flex-direction: column;
    gap: 8px;
}

body.is-phone .logo-icon {
    font-size: 30px;
}

body.is-phone .logo-text h1 {
    font-size: 18px;
}

body.is-phone .logo-text p {
    font-size: 12px;
}

body.is-phone .header-info {
    justify-content: center;
}

body.is-phone .input-section {
    padding: 16px;
}

body.is-phone .textarea-wrapper textarea {
    min-height: 100px;
    padding: 12px 14px;
    font-size: 14px;
}

body.is-phone .button-row {
    flex-direction: column;
    gap: 10px;
}

body.is-phone .btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
}

body.is-phone .status-section,
body.is-phone .result-section,
body.is-phone .error-section {
    padding: 16px;
}

body.is-phone .status-header {
    flex-direction: column;
}

body.is-phone .status-icon {
    font-size: 32px;
}

body.is-phone .result-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
}

body.is-phone .report-container {
    padding: 16px;
    font-size: 13px;
    max-height: 60vh;
}

body.is-phone .modal-content {
    width: 95%;
    max-height: 85vh;
}

body.is-phone .modal-header {
    padding: 12px 16px;
}

body.is-phone .modal-body {
    padding: 12px 16px;
}

body.is-phone .example-item {
    padding: 10px;
}

body.is-phone .footer {
    padding: 16px 10px;
}

/* 通用响应式断点 */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 16px;
    }
    
    .logo {
        flex-direction: column;
        gap: 8px;
    }
    
    .logo-icon {
        font-size: 28px;
    }
    
    .logo-text h1 {
        font-size: 18px;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .section-title h2 {
        font-size: 15px;
    }
    
    .status-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .status-info {
        text-align: center;
    }
    
    .progress-bar {
        height: 5px;
    }
    
    .error-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .report-container {
        padding: 16px;
        font-size: 13px;
        max-height: 50vh;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .header {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .logo-text h1 {
        font-size: 16px;
    }
    
    .logo-text p {
        font-size: 11px;
    }
    
    .input-section {
        padding: 12px;
    }
    
    .textarea-wrapper textarea {
        padding: 10px 12px;
        font-size: 14px;
        rows: 5;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .powered {
        font-size: 11px;
    }
    
    .report-container {
        font-size: 12px;
        padding: 12px;
    }
    
    .footer {
        font-size: 11px;
        padding: 12px 8px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}