/* Reset et variables CSS */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-dark: #0f172a;
    --bg-dark-secondary: #1e293b;
    --bg-dark-tertiary: #334155;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #ffffff;
    --text-dark: #cbd5e1;
    
    --border-color: #e2e8f0;
    --border-dark: #475569;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
}

/* Dark theme variables */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: #475569;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

/* Particles background */
#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: all var(--transition-normal);
}

[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: var(--border-dark);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-logo {
    height: 40px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.nav-controls {
    display: flex;
    gap: 0.5rem;
}

.theme-btn, .settings-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover, .settings-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Hero Section */
.hero {
    margin-top: 80px;
    padding: 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    animation: slideInUp 1s ease-out;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
    animation: slideInUp 1s ease-out 0.2s both;
}

.tech-stack {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: slideInUp 1s ease-out 0.4s both;
}

.tech-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all var(--transition-fast);
}

.tech-tag:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

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

/* Mode Selector */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.mode-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-lg);
}

/* Calculator Container */
.calculator-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.calculator-mode {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.calculator-mode.active {
    display: block;
}

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

/* Standard Calculator */
.calculators-wrapper {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: start;
}

.calculator {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.calculator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.calculator:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl), 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.calc-header {
    margin-bottom: 1.5rem;
}

.calc-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.calc-display {
    position: relative;
}

.operand {
    width: 100%;
    padding: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: right;
    transition: all var(--transition-fast);
}

.operand:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.key {
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.key::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.key:hover::before {
    width: 100%;
    height: 100%;
}

.key:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.key.function {
    background: var(--accent-color);
    color: white;
}

.key.function:hover {
    background: #d97706;
}

/* Operator Panel */
.operator-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.operators {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.op-btn {
    padding: 1rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.op-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.op-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-lg);
}

.equals {
    padding: 1rem 2rem;
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--success-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.equals:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.result-container {
    text-align: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    min-width: 200px;
}

.result {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.result.show {
    animation: resultPop 0.5s ease-out;
}

@keyframes resultPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Scientific Calculator */
.scientific-calculator {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
}

.sci-display {
    margin-bottom: 2rem;
}

.sci-input {
    width: 100%;
    padding: 1.5rem;
    font-size: 2rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: right;
    margin-bottom: 0.5rem;
}

.sci-expression {
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: right;
    min-height: 1.5rem;
}

.sci-keypad {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.sci-btn {
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sci-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.sci-btn.function {
    background: var(--accent-color);
    color: white;
}

/* Financial Calculator */
.financial-calculator {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
}

.fin-display {
    margin-bottom: 2rem;
}

.fin-input {
    width: 100%;
    padding: 1.5rem;
    font-size: 2rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    text-align: right;
}

.fin-functions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.fin-btn {
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.fin-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.fin-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.fin-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.fin-input-group input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.fin-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Converter Calculator */
.converter-calculator {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
}

.converter-selector {
    margin-bottom: 2rem;
}

.converter-selector select {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

.converter-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
}

.conv-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.conv-input-group input,
.conv-input-group select {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1.125rem;
    transition: all var(--transition-fast);
}

.conv-input-group input:focus,
.conv-input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.conv-swap button {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.conv-swap button:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

/* History Panel */
.history-panel {
    position: fixed;
    right: 0;
    top: 80px;
    width: 350px;
    height: calc(100vh - 80px);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    z-index: 100;
}

.history-panel.show {
    transform: translateX(0);
}

.history-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-header button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--danger-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-header button:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.history-item {
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.history-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(5px);
}

.history-chart {
    padding: 1rem;
    height: 200px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.5rem;
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.setting-group select,
.setting-group input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.setting-group select:focus,
.setting-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.setting-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    z-index: 100;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
}

.action-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

/* Responsive Design - Amélioré et étendu */

/* Tablettes en mode paysage */
@media (max-width: 1200px) {
    .calculators-wrapper {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 800px;
        margin: 0 auto;
    }
    
    .operator-panel {
        flex-direction: row;
        justify-content: center;
        margin: 1.5rem 0;
        gap: 1rem;
    }
    
    .operators {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
    
    .hero {
        padding: 3rem 2rem;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .tech-stack {
        gap: 0.75rem;
    }
    
    .tech-tag {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* Tablettes en mode portrait */
@media (max-width: 1024px) {
    .navbar {
        padding: 1rem 1.5rem;
    }
    
    .nav-brand h2 {
        font-size: 1.25rem;
    }
    
    .hero {
        padding: 2.5rem 1.5rem;
    }
    
    .hero h1 {
        font-size: 2.25rem;
    }
    
    .hero p {
        font-size: 1.1rem;
        max-width: 600px;
    }
    
    .mode-selector {
        padding: 1.5rem;
        gap: 1rem;
    }
    
    .mode-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .calculator-container {
        padding: 1.5rem;
    }
    
    .calculator {
        padding: 2rem;
    }
    
    .keypad {
        gap: 0.75rem;
    }
    
    .key {
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .sci-keypad {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.75rem;
    }
    
    .sci-btn {
        padding: 0.875rem;
        font-size: 0.9rem;
    }
    
    .fin-functions {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    .fin-btn {
        padding: 0.875rem;
        font-size: 0.9rem;
    }
    
    .action-buttons {
        bottom: 2rem;
        left: 2rem;
        right: 2rem;
        gap: 1rem;
    }
    
    .action-btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .history-panel {
        width: 400px;
    }
    
    .modal-content {
        max-width: 90%;
        margin: 2rem auto;
    }
}

/* Tablettes et grands mobiles */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-brand h2 {
        font-size: 1.1rem;
    }
    
    .nav-logo {
        width: 32px;
        height: 32px;
    }
    
    .hero {
        padding: 2rem 1rem;
        margin-top: 70px;
    }
    
    .hero h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero p {
        font-size: 1rem;
        margin: 1rem 0;
    }
    
    .tech-stack {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .tech-tag {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .mode-selector {
        flex-wrap: wrap;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .mode-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        flex: 1;
        min-width: 120px;
    }
    
    .calculator-container {
        padding: 1rem;
    }
    
    .calculator {
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .calc-header h3 {
        font-size: 1.1rem;
    }
    
    .operand {
        font-size: 1.1rem;
        padding: 0.75rem;
    }
    
    .keypad {
        gap: 0.5rem;
        grid-template-columns: repeat(4, 1fr);
    }
    
    .key {
        padding: 0.75rem;
        font-size: 1rem;
        min-height: 50px;
    }
    
    .operator-panel {
        flex-direction: column;
        gap: 0.75rem;
        margin: 1rem 0;
    }
    
    .operators {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .op-btn {
        padding: 0.625rem;
        font-size: 0.9rem;
        min-height: 45px;
    }
    
    .equals {
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
    }
    
    .scientific-calculator {
        padding: 1.5rem;
    }
    
    .sci-display {
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .sci-input {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .sci-keypad {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }
    
    .sci-btn {
        padding: 0.625rem;
        font-size: 0.85rem;
        min-height: 45px;
    }
    
    .financial-calculator {
        padding: 1.5rem;
    }
    
    .fin-display {
        padding: 1rem;
        font-size: 1.1rem;
    }
    
    .fin-input {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .fin-functions {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }
    
    .fin-btn {
        padding: 0.625rem;
        font-size: 0.75rem;
        min-height: 35px;
    }
    
    .fin-inputs {
        gap: 0.5rem;
    }
    
    .fin-input-group {
        gap: 0.375rem;
    }
    
    .fin-input-group input {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .converter-calculator {
        padding: 1rem;
    }
    
    .converter-selector select {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    .converter-inputs {
        gap: 0.5rem;
    }
    
    .conv-input-group {
        gap: 0.375rem;
    }
    
    .conv-input-group input,
    .conv-input-group select {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .swap-btn {
        padding: 0.625rem;
        font-size: 0.8rem;
    }
    
    .action-buttons {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        transform: none;
        gap: 0.75rem;
        position: fixed;
        z-index: 999;
    }
    
    .action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .history-panel {
        top: 60px;
        height: calc(100vh - 60px);
        left: 0;
        right: 0;
    }
    
    .history-header {
        padding: 0.75rem;
    }
    
    .history-header h3 {
        font-size: 1.1rem;
    }
    
    .history-list {
        padding: 0.75rem;
    }
    
    .history-item {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .setting-group {
        margin-bottom: 0.75rem;
    }
    
    .setting-group label {
        font-size: 0.95rem;
    }
    
    .setting-group select,
    .setting-group input[type="number"] {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .voice-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
        bottom: 15px;
    right: 15px;
    }
    
    .stats-panel {
        padding: 0.5rem;
    }
    
    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.5rem 0;
    }
    
    .stat-item span:first-child {
        font-size: 0.9rem;
    }
    
    .stat-item span:last-child {
        font-size: 1rem;
    }
}

/* Mobiles moyens */
@media (max-width: 600px) {
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    .mode-btn {
        min-width: 100px;
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
    
    .calculator {
        padding: 1.25rem;
    }
    
    .key {
        padding: 0.625rem;
        font-size: 0.95rem;
        min-height: 45px;
    }
    
    .op-btn {
        padding: 0.625rem;
        font-size: 0.95rem;
        min-height: 40px;
    }
    
    .sci-btn {
        padding: 0.625rem;
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    .fin-btn {
        padding: 0.625rem;
        font-size: 0.8rem;
        min-height: 40px;
    }
    
    .action-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.85rem;
    }
}

/* Petits mobiles */
@media (max-width: 480px) {
    .navbar {
        padding: 0.75rem;
    }
    
    .nav-brand h2 {
        font-size: 1rem;
    }
    
    .nav-logo {
        width: 28px;
        height: 28px;
    }
    
    .hero {
        padding: 1.5rem 0.75rem;
        margin-top: 60px;
    }
    
    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .hero p {
        font-size: 0.9rem;
        margin: 0.75rem 0;
    }
    
    .tech-stack {
        flex-direction: column;
        align-items: center;
        gap: 0.375rem;
    }
    
    .tech-tag {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .mode-selector {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .mode-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
        min-width: 80px;
        flex: 1;
    }
    
    .calculator-container {
        padding: 0.75rem;
    }
    
    .calculator {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .calc-header h3 {
        font-size: 1rem;
    }
    
    .operand {
        font-size: 1rem;
        padding: 0.625rem;
    }
    
    .keypad {
        gap: 0.375rem;
        grid-template-columns: repeat(3, 1fr);
    }
    
    .key {
        padding: 0.625rem;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .operator-panel {
        gap: 0.5rem;
        margin: 0.75rem 0;
    }
    
    .operators {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.375rem;
    }
    
    .op-btn {
        padding: 0.625rem;
        font-size: 0.9rem;
        min-height: 35px;
    }
    
    .equals {
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
    }
    
    .scientific-calculator {
        padding: 1rem;
    }
    
    .sci-display {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .sci-input {
        font-size: 0.9rem;
        padding: 0.625rem;
    }
    
    .sci-keypad {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.375rem;
    }
    
    .sci-btn {
        padding: 0.625rem;
        font-size: 0.75rem;
        min-height: 35px;
    }
    
    .financial-calculator {
        padding: 1rem;
    }
    
    .fin-display {
        padding: 0.75rem;
        font-size: 1rem;
    }
    
    .fin-input {
        font-size: 0.9rem;
        padding: 0.625rem;
    }
    
    .fin-functions {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }
    
    .fin-btn {
        padding: 0.625rem;
        font-size: 0.75rem;
        min-height: 35px;
    }
    
    .fin-inputs {
        gap: 0.5rem;
    }
    
    .fin-input-group {
        gap: 0.375rem;
    }
    
    .fin-input-group input {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .converter-calculator {
        padding: 1rem;
    }
    
    .converter-selector select {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    .converter-inputs {
        gap: 0.5rem;
    }
    
    .conv-input-group {
        gap: 0.375rem;
    }
    
    .conv-input-group input,
    .conv-input-group select {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .swap-btn {
        padding: 0.625rem;
        font-size: 0.8rem;
    }
    
    .action-buttons {
        bottom: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        gap: 0.5rem;
    }
    
    .action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .history-panel {
        top: 50px;
        height: calc(100vh - 50px);
    }
    
    .history-header {
        padding: 0.75rem;
    }
    
    .history-header h3 {
        font-size: 1rem;
    }
    
    .history-list {
        padding: 0.75rem;
    }
    
    .history-item {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .setting-group {
        margin-bottom: 0.75rem;
    }
    
    .setting-group label {
        font-size: 0.9rem;
    }
    
    .setting-group select,
    .setting-group input[type="number"] {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    .voice-btn {
    width: 45px;
    height: 45px;
        font-size: 1rem;
        bottom: 10px;
        right: 10px;
    }
    
    .stats-panel {
        padding: 0.375rem;
    }
    
    .stat-item {
        padding: 0.375rem 0;
    }
    
    .stat-item span:first-child {
        font-size: 0.8rem;
    }
    
    .stat-item span:last-child {
        font-size: 0.9rem;
    }
}

/* Très petits écrans (smartphones compacts) */
@media (max-width: 360px) {
    .hero h1 {
        font-size: 1.25rem;
    }
    
    .hero p {
        font-size: 0.85rem;
    }
    
    .mode-btn {
        min-width: 70px;
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    .key {
        padding: 0.5rem;
        font-size: 0.85rem;
        min-height: 35px;
    }
    
    .op-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
        min-height: 30px;
    }
    
    .sci-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
        min-height: 30px;
    }
    
    .fin-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
        min-height: 30px;
    }
    
    .action-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
    
    .voice-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        bottom: 8px;
        right: 8px;
    }
}

/* Orientation paysage sur mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        padding: 1rem;
        margin-top: 50px;
    }
    
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.9rem;
        margin: 0.5rem 0;
    }
    
    .mode-selector {
        padding: 0.5rem;
    }
    
    .mode-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .calculator-container {
        padding: 0.5rem;
    }
    
    .calculator {
        padding: 1rem;
    }
    
    .action-buttons {
        bottom: 0.5rem;
        left: 0.5rem;
        right: 0.5rem;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .action-btn {
        flex: 1;
        min-width: 120px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .voice-btn {
        bottom: 8px;
        right: 8px;
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* Écrans haute densité (Retina) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .key,
    .op-btn,
    .sci-btn,
    .fin-btn,
    .action-btn {
        border-width: 0.5px;
    }
    
    .calculator::before {
        border-width: 1px;
    }
}

/* Préférences de réduction de mouvement */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .calculator:hover {
        animation: none;
    }
    
    .result.show {
        animation: none;
    }
}

/* Mode sombre automatique */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --border-color: #475569;
    }
}

/* Support des écrans tactiles */
@media (hover: none) and (pointer: coarse) {
    .key,
    .op-btn,
    .sci-btn,
    .fin-btn,
    .action-btn,
    .mode-btn,
    .theme-btn,
    .settings-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .voice-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .key:hover,
    .op-btn:hover,
    .sci-btn:hover,
    .fin-btn:hover,
    .action-btn:hover,
    .mode-btn:hover,
    .theme-btn:hover,
    .settings-btn:hover {
        transform: none;
    }
    
    .key:active,
    .op-btn:active,
    .sci-btn:active,
    .fin-btn:active,
    .action-btn:active,
    .mode-btn:active,
    .theme-btn:active,
    .settings-btn:active {
        transform: scale(0.95);
    }
}

/* Animations supplémentaires */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.5); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8); }
}

.calculator:hover {
    animation: float 3s ease-in-out infinite;
}

.result.show {
    animation: glow 1s ease-out;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-sm);
}

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

/* Animations avancées */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Effets visuels personnalisés inspirés d'uiverse.io */

/* Particules personnalisées */
#custom-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2;
    overflow: hidden;
}

.custom-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: floatParticle 8s linear infinite;
    opacity: 0.6;
}

.custom-particle:nth-child(odd) {
    background: var(--secondary-color);
    animation-duration: 10s;
}

.custom-particle:nth-child(3n) {
    background: var(--accent-color);
    animation-duration: 12s;
}

.custom-particle:nth-child(4n) {
    background: var(--success-color);
    animation-duration: 6s;
}

/* Effet de néon pour le fond */
#neon-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
    z-index: -3;
    animation: neonBackgroundShift 20s ease infinite;
}

@keyframes neonBackgroundShift {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* Effet de grille cyberpunk */
#cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -4;
    animation: cyberGridMove 15s linear infinite;
}

@keyframes cyberGridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Animation de particules flottantes améliorée */
@keyframes floatParticle {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.8;
    }
    90% {
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100px) translateX(100px) rotate(360deg);
        opacity: 0;
    }
}

/* Effet de néon pour les éléments principaux */
.calculator::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.calculator:hover::before {
    opacity: 0.3;
    animation: neonGlow 2s ease-in-out infinite;
}

/* Effet de néon pour les boutons spéciaux */
.equals::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.equals:hover::before {
    opacity: 0.5;
    animation: neonGlow 1.5s ease-in-out infinite;
}

/* Animation de morphing pour les conteneurs */
.calculators-wrapper::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.calculators-wrapper:hover::before {
    opacity: 0.2;
    animation: morphing 4s ease-in-out infinite;
}

/* Effet de néon pour les inputs */
.operand::before,
.sci-input::before,
.fin-input::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: var(--primary-color);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.operand:focus::before,
.sci-input:focus::before,
.fin-input:focus::before {
    opacity: 0.3;
    animation: neonGlow 1s ease-in-out infinite;
}

/* Animation de pulse pour les éléments interactifs */
@keyframes pulseNeon {
    0%, 100% {
        box-shadow: 
            0 0 5px var(--primary-color),
            0 0 10px var(--primary-color),
            0 0 15px var(--primary-color);
    }
    50% {
        box-shadow: 
            0 0 10px var(--primary-color),
            0 0 20px var(--primary-color),
            0 0 30px var(--primary-color);
    }
}

/* Application de l'effet pulse néon */
.key:focus,
.op-btn:focus,
.sci-btn:focus,
.fin-btn:focus {
    animation: pulseNeon 1s ease-in-out infinite;
}

/* Effet de néon pour les résultats */
.result::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: var(--primary-color);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.result.show::before {
    opacity: 0.4;
    animation: neonGlow 2s ease-in-out infinite;
}

/* Animation de morphing pour les modales */
.modal-content::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal.show .modal-content::before {
    opacity: 0.3;
    animation: morphing 6s ease-in-out infinite;
}

/* Effet de néon pour les boutons d'action */
.action-btn::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: var(--primary-color);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.action-btn:hover::before {
    opacity: 0.4;
    animation: neonGlow 1.5s ease-in-out infinite;
}

/* Animation de rotation 3D pour les icônes */
@keyframes rotate3DEnhanced {
    0% {
        transform: rotateY(0deg) rotateX(0deg);
    }
    25% {
        transform: rotateY(90deg) rotateX(0deg);
    }
    50% {
        transform: rotateY(180deg) rotateX(90deg);
    }
    75% {
        transform: rotateY(270deg) rotateX(180deg);
    }
    100% {
        transform: rotateY(360deg) rotateX(360deg);
    }
}

/* Application de la rotation 3D améliorée */
.feature-card:hover .feature-icon i {
    animation: rotate3DEnhanced 1.5s ease-in-out;
}

/* Effet de néon pour les titres */
.demo-title::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--primary-color);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.demo-title:hover::before {
    opacity: 0.3;
    animation: neonGlow 2s ease-in-out infinite;
}

/* Animation de morphing pour les cartes */
.feature-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.feature-card:hover::before {
    opacity: 0.2;
    animation: morphing 4s ease-in-out infinite;
}

/* Effet de néon pour les badges technologiques */
.tech-badge::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tech-badge:hover::before {
    opacity: 0.4;
    animation: neonGlow 1.5s ease-in-out infinite;
}

/* Animation de wave améliorée */
@keyframes waveEnhanced {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(5deg);
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    75% {
        transform: scale(1.1) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Application de l'effet wave amélioré */
.equals:hover {
    animation: waveEnhanced 0.8s ease-in-out;
}

/* Effet de néon pour les éléments de navigation */
.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.navbar:hover::before {
    opacity: 0.1;
    animation: neonGlow 3s ease-in-out infinite;
}

/* Animation de morphing pour les panneaux */
.history-panel::before,
.stats-panel::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.history-panel:hover::before,
.stats-panel:hover::before {
    opacity: 0.2;
    animation: morphing 5s ease-in-out infinite;
}

/* Effet de néon pour les boutons de mode */
.mode-btn::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: var(--primary-color);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mode-btn:hover::before {
    opacity: 0.3;
    animation: neonGlow 1.5s ease-in-out infinite;
}

.mode-btn.active::before {
    opacity: 0.5;
    animation: neonGlow 2s ease-in-out infinite;
}

/* Boutons d'action */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
    padding: 0 1rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-lg);
    background: var(--secondary-color);
}

.action-btn:active {
    transform: translateY(0) scale(0.98);
}

.action-btn i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.action-btn:hover i {
    transform: rotate(360deg);
}

/* Modal d'aide */
.help-modal .modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.help-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.help-section strong {
    color: var(--accent-color);
    font-weight: 600;
}

/* Amélioration des boutons scientifiques */
.sci-keypad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    padding: 1rem;
}

.sci-btn {
    padding: 1rem 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sci-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.sci-btn:hover::before {
    width: 200%;
    height: 200%;
}

.sci-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    border-color: var(--primary-color);
    color: white;
}

.sci-btn.function {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.sci-btn.function:hover {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Amélioration des boutons financiers */
.fin-functions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.fin-btn {
    padding: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.fin-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.fin-btn:hover::after {
    transform: translateX(100%);
}

.fin-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* Effets de néon améliorés pour tous les boutons */
.key, .op-btn, .sci-btn, .fin-btn, .action-btn, .mode-btn, .equals {
    position: relative;
    overflow: hidden;
}

.key::before, .op-btn::before, .sci-btn::before, .fin-btn::before, .action-btn::before, .mode-btn::before, .equals::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.key:hover::before, .op-btn:hover::before, .sci-btn:hover::before, .fin-btn:hover::before, .action-btn:hover::before, .mode-btn:hover::before, .equals:hover::before {
    left: 100%;
}

/* Animation de pulse pour les boutons actifs */
.key:active, .op-btn:active, .sci-btn:active, .fin-btn:active, .action-btn:active, .mode-btn:active, .equals:active {
    animation: pulseActive 0.3s ease-in-out;
}

/* Effet de ripple amélioré */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.key, .op-btn, .sci-btn, .fin-btn, .action-btn, .mode-btn, .equals {
    position: relative;
}

.key::after, .op-btn::after, .sci-btn::after, .fin-btn::after, .action-btn::after, .mode-btn::after, .equals::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: all 0.3s ease;
}

.key:active::after, .op-btn:active::after, .sci-btn:active::after, .fin-btn:active::after, .action-btn:active::after, .mode-btn:active::after, .equals:active::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: ripple 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .calculators-wrapper {
        flex-direction: column;
        gap: 2rem;
    }
    
    .operator-panel {
        order: -1;
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
    }
    
    .operators {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .action-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .action-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .sci-keypad {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .fin-functions {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .mode-selector {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mode-btn {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .calculator {
        padding: 1rem;
    }
    
    .keypad {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .key {
        padding: 1rem 0.5rem;
        font-size: 1.1rem;
    }
    
    .operators {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .op-btn {
        padding: 1rem 0.5rem;
        font-size: 1.2rem;
    }
    
    .equals {
        padding: 1.5rem 1rem;
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .sci-keypad {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem;
    }
    
    .sci-btn {
        padding: 0.75rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .fin-functions {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .fin-btn {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .help-modal .modal-content {
        margin: 1rem;
        max-height: 90vh;
    }
    
    .help-section {
        padding: 0.75rem;
    }
    
    .help-section li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    .tech-stack {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .tech-tag {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .calculator {
        padding: 0.75rem;
    }
    
    .calc-header h3 {
        font-size: 1rem;
    }
    
    .operand {
        font-size: 1.2rem;
        padding: 0.5rem;
    }
    
    .keypad {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem;
    }
    
    .key {
        padding: 0.75rem 0.25rem;
        font-size: 1rem;
    }
    
    .op-btn {
        padding: 0.75rem 0.25rem;
        font-size: 1.1rem;
    }
    
    .equals {
        padding: 1rem 0.5rem;
        font-size: 1.3rem;
    }
    
    .result {
        font-size: 1.5rem;
        padding: 0.75rem;
    }
    
    .action-buttons {
        padding: 0 0.5rem;
    }
    
    .action-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .action-btn i {
        font-size: 1rem;
    }
    
    .sci-keypad {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem;
    }
    
    .sci-btn {
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
    }
    
    .fin-functions {
        gap: 0.25rem;
    }
    
    .fin-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .fin-input-group {
        margin-bottom: 0.75rem;
    }
    
    .fin-input-group label {
        font-size: 0.8rem;
    }
    
    .fin-input-group input {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .converter-inputs {
        flex-direction: column;
        gap: 1rem;
    }
    
    .conv-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .conv-input-group input,
    .conv-input-group select {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
    
    .history-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .history-panel.show {
        transform: translateX(0);
    }
    
    .history-header {
        padding: 1rem;
    }
    
    .history-list {
        padding: 0.75rem;
    }
    
    .history-item {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .setting-group {
        margin-bottom: 1rem;
    }
    
    .setting-group label {
        font-size: 0.9rem;
    }
    
    .setting-group input,
    .setting-group select {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 360px) {
    .hero h1 {
        font-size: 1.3rem;
    }
    
    .hero p {
        font-size: 0.8rem;
    }
    
    .tech-tag {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    .calculator {
        padding: 0.5rem;
    }
    
    .calc-header h3 {
        font-size: 0.9rem;
    }
    
    .operand {
        font-size: 1.1rem;
        padding: 0.4rem;
    }
    
    .key {
        padding: 0.6rem 0.2rem;
        font-size: 0.9rem;
    }
    
    .op-btn {
        padding: 0.6rem 0.2rem;
        font-size: 1rem;
    }
    
    .equals {
        padding: 0.8rem 0.4rem;
        font-size: 1.2rem;
    }
    
    .result {
        font-size: 1.3rem;
        padding: 0.6rem;
    }
    
    .action-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .action-btn i {
        font-size: 0.9rem;
    }
    
    .sci-btn {
        padding: 0.4rem 0.2rem;
        font-size: 0.6rem;
    }
    
    .fin-btn {
        padding: 0.4rem;
        font-size: 0.7rem;
    }
    
    .fin-input-group label {
        font-size: 0.7rem;
    }
    
    .fin-input-group input {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    .conv-input-group input,
    .conv-input-group select {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    .history-item {
        padding: 0.4rem;
        font-size: 0.7rem;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .setting-group label {
        font-size: 0.8rem;
    }
    
    .setting-group input,
    .setting-group select {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
}

/* Orientation landscape pour mobile */
@media (orientation: landscape) and (max-height: 600px) {
    .hero {
        padding: 1rem 0;
    }
    
    .hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .hero p {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    
    .tech-stack {
        gap: 0.3rem;
    }
    
    .tech-tag {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    .mode-selector {
        padding: 0.5rem 1rem;
        gap: 0.3rem;
    }
    
    .mode-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .calculator-container {
        padding: 0.5rem;
    }
    
    .calculator {
        padding: 0.5rem;
    }
    
    .action-buttons {
        margin: 1rem 0;
        gap: 0.5rem;
    }
    
    .action-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .sci-keypad {
        gap: 0.2rem;
    }
    
    .sci-btn {
        padding: 0.3rem 0.1rem;
        font-size: 0.7rem;
        min-height: 2.2rem;
    }
    
    .fin-functions {
        gap: 0.3rem;
        margin-bottom: 1rem;
    }
    
    .fin-btn {
        padding: 0.4rem;
        font-size: 0.8rem;
        min-height: 2.5rem;
    }
    
    .fin-input-group {
        margin-bottom: 0.5rem;
    }
    
    .fin-input-group label {
        font-size: 0.7rem;
        margin-bottom: 0.2rem;
    }
    
    .fin-input-group input {
        padding: 0.3rem;
        font-size: 0.8rem;
        height: 2rem;
    }
    
    .converter-inputs {
        gap: 0.5rem;
    }
    
    .conv-input-group input,
    .conv-input-group select {
        padding: 0.3rem;
        font-size: 0.8rem;
        height: 2rem;
    }
    
    .history-panel {
        max-height: 80vh;
    }
    
    .history-header {
        padding: 0.5rem;
    }
    
    .history-list {
        padding: 0.4rem;
        max-height: 60vh;
    }
    
    .history-item {
        padding: 0.3rem;
        font-size: 0.7rem;
    }
    
    .modal-content {
        max-height: 90vh;
        margin: 0.5rem;
        padding: 0.8rem;
    }
    
    .modal-header h3 {
        font-size: 1rem;
    }
    
    .setting-group {
        margin-bottom: 0.8rem;
    }
    
    .setting-group label {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
    }
    
    .setting-group input,
    .setting-group select {
        padding: 0.3rem;
        font-size: 0.8rem;
        height: 2rem;
    }
}
