:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --secondary-color: #6c757d;
    --display-bg: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    --display-text: #212529;
    --display-history: #6c757d;
}

.card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #0d6efd 100%);
    padding: 1.5rem;
}

.card-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

/* Calculator Container */
.calculator-container {
    margin: 0 auto;
}

/* Display */
.calculator-display {
    background: var(--display-bg);
    border-radius: 8px;
    padding: 0 10px;
    position: relative;
    border: 2px solid #dee2e6;
}

.display-input {
    min-height: 55px;
    color: var(--display-text);
    font-size: 2.4rem;
    font-weight: 600;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Roboto', 'Courier New', monospace;
    letter-spacing: -0.5px;
}

/* Calculator Buttons */
.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.btn-calculator {
    aspect-ratio: 1;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.12);
    min-height: 50px;
    position: relative;
    overflow: hidden;
    border-width: 1.5px;
}

.btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.btn-calculator .material-icons {
    font-size: 1.4rem;
    line-height: 1;
}

.btn-text {
    font-size: 1.6rem;
    line-height: 1;
    font-weight: 700;
}

.btn-calculator:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.18);
}

.btn-calculator:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-calculator.btn-outline-primary {
    background: rgba(13, 110, 253, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-calculator.btn-outline-primary:hover {
    background: rgba(13, 110, 253, 0.2);
}

.btn-calculator.btn-outline-danger {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-calculator.btn-outline-danger:hover {
    background: rgba(220, 53, 69, 0.2);
}

.btn-calculator.btn-outline-secondary {
    background: rgba(255, 255, 255, 0.9);
    border-color: #dee2e6;
    color: #495057;
}

.btn-calculator.btn-outline-secondary:hover {
    background: rgba(248, 249, 250, 0.95);
}

.btn-calculator.btn-success {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
    border: none;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.35);
}

.btn-calculator.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(25, 135, 84, 0.45);
}

/* History */
.calculator-history {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 18px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.calculator-history .btn {
    transition: all 0.2s ease;
}

.calculator-history .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calculator-history .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.history-list {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.history-item {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.history-item:hover {
    background-color: #e7f1ff;
    transform: translateX(3px);
}

.history-item::after {
    content: 'Нажмите, чтобы скопировать';
    position: absolute;
    top: -5px;
    right: 3px;
    font-size: 0.75rem;
    color: #6c757d;
    opacity: 0;
    transition: opacity 0.3s;
}

.history-item:hover::after {
    opacity: 0.8;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.history-item-expression {
    font-size: 0.9rem;
    color: #6c757d;
    font-family: 'Roboto', 'Courier New', monospace;
}

.history-item-result {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
    font-family: 'Roboto', 'Courier New', monospace;
}

/* Description Section */
.card-body p {
    line-height: 1.7;
}

.card-body code {
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.card-body kbd {
    background-color: #7f8080;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Roboto', monospace;
}

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

.btn-calculator.pulse {
    animation: pulse 0.3s ease;
}

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

.calculator-container {
    animation: slideIn 0.5s ease-out;
    max-width: 400px;
}

/* Responsive */
@media (max-width: 768px) {
    .calculator-buttons {
        gap: 5px;
    }

    .btn-calculator {
        min-height: 48px;
    }

    .btn-text {
        font-size: 1.45rem;
    }

    .btn-calculator .material-icons {
        font-size: 1.25rem;
    }

    .display-input {
        font-size: 2rem;
        min-height: 50px;
    }

    .calculator-history {
        padding: 15px;
    }

    .history-item {
        padding: 8px 10px;
    }

    .card-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .calculator-buttons {
        gap: 4px;
    }

    .btn-calculator {
        min-height: 44px;
        font-size: 0.75rem;
    }

    .btn-text {
        font-size: 1.35rem;
    }

    .btn-calculator .material-icons {
        font-size: 1.1rem;
    }

    .display-input {
        font-size: 1.8rem;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-item-result {
        margin-top: 3px;
        font-size: 1rem;
    }

    .btn-zero {
        grid-column: span 2;
    }
}

/* Scrollbar styling */
.history-list::-webkit-scrollbar {
    width: 5px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Toast notification for paste */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    min-width: 280px;
}