/* 计算器工具CSS文件 - 基于随机数工具样式 */

:root {
    /* 颜色系统 */
    --primary-color: #4f46e5; /* Indigo-600 */
    --primary-light: #6366f1; /* Indigo-500 */
    --primary-dark: #4338ca; /* Indigo-700 */
    --success-color: #10b981; /* Emerald-500 */
    --warning-color: #f59e0b; /* Amber-500 */
    --danger-color: #ef4444; /* Red-500 */
}

/* 背景样式 */
body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f0f4ff 0%, #f9fafb 50%, #f0fdfa 100%);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.08) 0%, rgba(79, 70, 229, 0.02) 25%, transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.01) 30%, transparent 55%),
        radial-gradient(circle at 70% 80%, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.01) 35%, transparent 60%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
}

.dark-theme body {
    background: linear-gradient(135deg, #111827 0%, #1e293b 50%, #0f172a 100%);
}

.dark-theme body::before {
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.08) 0%, rgba(79, 70, 229, 0.03) 30%, transparent 60%),
        radial-gradient(circle at 80% 30%, rgba(6, 182, 212, 0.06) 0%, rgba(6, 182, 212, 0.02) 35%, transparent 65%),
        radial-gradient(circle at 70% 80%, rgba(124, 58, 237, 0.07) 0%, rgba(124, 58, 237, 0.02) 40%, transparent 70%);
    opacity: 0.7;
}

/* 暗色主题变量 */
.dark-theme {
    --primary-color: #6366f1; /* Indigo-500 */
    --primary-light: #818cf8; /* Indigo-400 */
    --primary-dark: #4338ca; /* Indigo-700 */
}

/* 隐藏滚动条但保持功能 */
.hide-scrollbar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 文本渐变效果 */
.text-gradient {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

/* 头部样式 */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.75rem 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.95) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

.dark-theme header {
    background: linear-gradient(135deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

/* 导航菜单样式 */
.nav-menu {
    display: flex;
    align-items: center;
    margin-left: 2rem;
    flex: 1;
}

.nav-menu ul {
    display: flex;
    list-style: none;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: var(--tw-text-secondary, #374151);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s;
    position: relative;
    padding: 0.5rem 0;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--tw-primary-600, #4f46e5);
    transition: width 0.15s;
}

.nav-menu a:hover {
    color: var(--tw-primary-600, #4f46e5);
}

.nav-menu a:hover::after {
    width: 100%;
}

.nav-menu a.active {
    color: var(--tw-primary-600, #4f46e5);
}

.nav-menu a.active::after {
    width: 100%;
}

/* 计算器模式选择区域 */
.calc-modes-container {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    scrollbar-width: thin;
    scroll-behavior: smooth;
    margin-bottom: 0.7rem;
    margin-top: 0;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.calc-mode-card {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    width: auto;
    min-width: 0;
    background-color: white;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid rgba(229, 231, 235, 0.5);
    text-align: center;
    justify-content: flex-start;
    transition: all 0.2s ease;
}

.dark-theme .calc-mode-card {
    background-color: #1f2937;
    color: #f9fafb;
    border-color: rgba(55, 65, 81, 0.5);
}

.calc-mode-card:hover {
    color: #4f46e5;
    border-color: #4f46e5;
}

.calc-mode-card.active {
    border-color: #4f46e5;
    color: #4f46e5;
}

.mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background-color: #f9fafb;
    margin-right: 0.5rem;
    font-size: 1rem;
    color: #4f46e5;
}

.dark-theme .mode-icon {
    background-color: #1f2937;
}

.mode-info {
    flex-grow: 0;
    text-align: left;
}

.mode-info h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
    color: #111827;
}

.dark-theme .mode-info h3 {
    color: #f9fafb;
}

.mode-info p {
    font-size: 0.7rem;
    margin: 0;
    color: #374151;
    line-height: 1.2;
}

.dark-theme .mode-info p {
    color: #e5e7eb;
}

/* 主题切换按钮 */
.theme-toggle {
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    transition: all 0.15s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: transparent;
}

.theme-toggle:hover {
    color: #4f46e5;
    background-color: rgba(79, 70, 229, 0.05);
}

/* 卡片样式 */
.card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 8px;
    border: 1px solid rgba(229, 231, 235, 0.5);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dark-theme .card {
    background: rgba(31, 41, 55, 0.7);
    border: 1px solid rgba(55, 65, 81, 0.5);
}

/* 计算器按钮样式 */
.calc-button {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(229, 231, 235, 0.5);
    border-radius: 8px;
    background-color: white;
    color: #374151;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
}

.dark-theme .calc-button {
    background-color: #1f2937;
    color: #e5e7eb;
    border-color: rgba(55, 65, 81, 0.5);
}

.calc-button:hover {
    background-color: #f3f4f6;
    border-color: #4f46e5;
    transform: translateY(-1px);
}

.dark-theme .calc-button:hover {
    background-color: #374151;
    border-color: #6366f1;
}

.calc-button:active {
    transform: translateY(0);
}

.calc-button.operator {
    background-color: #4f46e5;
    color: white;
}

.calc-button.operator:hover {
    background-color: #4338ca;
}

.calc-button.equals {
    background-color: #10b981;
    color: white;
}

.calc-button.equals:hover {
    background-color: #059669;
}

.calc-button.clear {
    background-color: #ef4444;
    color: white;
}

.calc-button.clear:hover {
    background-color: #dc2626;
}

/* 计算器显示屏 */
.calc-display {
    background-color: #1f2937;
    color: #10b981;
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem;
    border-radius: 8px;
    text-align: right;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border: 2px solid rgba(16, 185, 129, 0.3);
    margin-bottom: 1rem;
}

.dark-theme .calc-display {
    background-color: #111827;
    color: #34d399;
}

/* 科学计算器专用样式 */
.angle-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid rgba(229, 231, 235, 0.3);
}

.angle-option {
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    color: #6b7280;
}

.angle-option.active {
    background: #4f46e5;
    color: white;
}

.dark-theme .angle-toggle {
    background: rgba(31, 41, 55, 0.5);
    border-color: rgba(55, 65, 81, 0.5);
}

.dark-theme .angle-option {
    color: #9ca3af;
}

/* 计算器显示屏样式已在HTML中使用Tailwind类定义 */



/* 按钮基础样式 - 参考jsq.html */
.calc-btn {
    height: 3rem;
    font-size: 1.125rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    user-select: none;
}

.calc-btn:focus {
    box-shadow: 0 0 0 2px #4f46e5, 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* 数字按钮 - 继承calc-btn样式 */
.calc-btn-number {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
}

.calc-btn-number:hover {
    background: #f9fafb;
}

/* 运算符按钮 - 继承calc-btn样式 */
.calc-btn-operator {
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    color: white;
    border: none;
}

.calc-btn-operator:hover {
    background: linear-gradient(to right, #4338ca, #6d28d9);
}

/* 功能按钮 - 继承calc-btn样式 */
.calc-btn-function {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
}

.calc-btn-function:hover {
    background: #e5e7eb;
}

/* 等号按钮 - 继承calc-btn样式 */
.calc-btn-equals {
    background: linear-gradient(to right, #10b981, #059669);
    color: white;
    border: none;
}

.calc-btn-equals:hover {
    background: linear-gradient(to right, #059669, #047857);
}

/* 清除按钮 - 继承calc-btn样式 */
.calc-btn-clear {
    background: linear-gradient(to right, #ef4444, #ec4899);
    color: white;
    border: none;
}

.calc-btn-clear:hover {
    background: linear-gradient(to right, #dc2626, #db2777);
}

/* 暗色主题样式 */
.dark-theme .calc-btn-number {
    background: #374151;
    border: 1px solid #4b5563;
    color: #e5e7eb;
}

.dark-theme .calc-btn-number:hover {
    background: #4b5563;
}

.dark-theme .calc-btn-function {
    background: #1f2937;
    border: 1px solid #374151;
    color: #d1d5db;
}

.dark-theme .calc-btn-function:hover {
    background: #374151;
}

.calc-button.memory-button {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%);
    border-color: rgba(245, 158, 11, 0.3);
    color: #d97706;
    font-size: 0.85rem;
}

.calc-button.memory-button:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(217, 119, 6, 0.2) 100%);
    border-color: rgba(245, 158, 11, 0.5);
}

/* 暗色主题下的按钮样式 */
.dark-theme .calc-btn-number {
    background: #2d3748;
    color: #e2e8f0;
}

.dark-theme .calc-btn-number:hover {
    background: #4a5568;
    transform: scale(0.98);
}

.dark-theme .calc-btn-function {
    background: #4a5568;
    color: #e2e8f0;
}

.dark-theme .calc-btn-function:hover {
    background: #718096;
    transform: scale(0.98);
}

/* 运算符、等号、清除按钮在暗色主题下保持相同样式 */
.dark-theme .calc-btn-operator {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.dark-theme .calc-btn-operator:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: scale(0.98);
}

.dark-theme .calc-btn-equals {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.dark-theme .calc-btn-equals:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: scale(0.98);
}

.dark-theme .calc-btn-clear {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.dark-theme .calc-btn-clear:hover {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    transform: scale(0.98);
}

/* 进制显示样式（用于程序员计算器） */
.base-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.base-item {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(229, 231, 235, 0.5);
    border-radius: 6px;
    padding: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.dark-theme .base-item {
    background: rgba(31, 41, 55, 0.6);
    border-color: rgba(55, 65, 81, 0.5);
}

.base-label {
    font-size: 0.7rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.dark-theme .base-label {
    color: #9ca3af;
}

/* Toast通知样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(31, 41, 55, 0.95);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.dark-theme .toast {
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
}

/* 历史记录项样式 */
.history-item {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.history-item:hover {
    background: rgba(79, 70, 229, 0.05);
    border-color: rgba(79, 70, 229, 0.2);
}

.dark-theme .history-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

/* 响应式样式 */
@media (max-width: 767px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        margin-left: 0;
        background: #ffffff;
        padding: 1rem;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        z-index: 99;
        border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    }
    
    .dark-theme .nav-menu {
        background: #111827;
        border-bottom: 1px solid rgba(55, 65, 81, 0.5);
    }
    
    .nav-menu.active {
        display: block;
    }
    
    .nav-menu ul {
        flex-direction: column;
    }
    
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background-color: transparent;
        cursor: pointer;
        color: #6b7280;
        transition: all 0.15s;
        border: 1px solid transparent;
    }
    
    .mobile-menu-btn:hover {
        color: #4f46e5;
        background-color: rgba(79, 70, 229, 0.05);
        border-color: rgba(79, 70, 229, 0.1);
    }
    
    .calc-mode-card {
        scroll-snap-align: start;
        flex: 0 0 auto;
        min-width: 200px;
        padding: 0.4rem 0.6rem;
    }
    
    .mode-icon {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .mode-info h3 {
        font-size: 0.75rem;
    }
    
    .mode-info p {
        font-size: 0.65rem;
    }
    
    .calc-button {
        min-height: 44px;
        font-size: 0.9rem;
    }
    
    .calc-display {
        font-size: 1.2rem;
        min-height: 50px;
    }
}

/* 动画效果 */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.calc-button:active {
    animation: buttonPress 0.1s ease;
}

/* 特殊功能按钮样式 */
.function-button {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    font-size: 0.85rem;
}

.function-button:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* 进制显示样式 */
.base-display {
    font-family: 'Courier New', monospace;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.9rem;
    color: #374151;
}

.dark-theme .base-display {
    background-color: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

/* 单位转换器样式 */
.unit-converter-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.unit-selector {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    color: #374151;
}

.dark-theme .unit-selector {
    background-color: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

/* 图形计算器容器 */
.graph-container {
    width: 100%;
    height: 400px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
}

.dark-theme .graph-container {
    border-color: #4b5563;
}

/* 历史记录样式 */
.history-item {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    transition: background-color 0.15s ease;
}

.history-item:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

.dark-theme .history-item {
    border-bottom-color: rgba(55, 65, 81, 0.5);
}

.dark-theme .history-item:hover {
    background-color: rgba(99, 102, 241, 0.1);
}

/* 内存按钮样式 */
.memory-button {
    background-color: #f59e0b;
    color: white;
    font-size: 0.8rem;
    padding: 0.5rem;
}

.memory-button:hover {
    background-color: #d97706;
}

/* 角度单位切换 */
.angle-toggle {
    display: flex;
    background-color: #f3f4f6;
    border-radius: 6px;
    padding: 2px;
}

.dark-theme .angle-toggle {
    background-color: #374151;
}

.angle-option {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.8rem;
    font-weight: 500;
}

.angle-option.active {
    background-color: #4f46e5;
    color: white;
}

/* Toast 通知样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #1f2937;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.dark-theme .toast {
    background-color: #374151;
}

/* 暗色主题相关变量 */
.dark-theme {
    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-tertiary: #9ca3af;
    --text-quaternary: #6b7280;
    --bg-light: #1f2937;
    --bg-color: #111827;
    --bg-color-rgb: 17, 24, 39;
    --bg-dark: #111827;
    --bg-secondary: #374151;
    --bg-tertiary: #374151;
    --bg-quaternary: #4b5563;
    --card-bg: #1f2937;
    --border-color: #374151;
    --border-light: #1f2937;
} 