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

body {
    margin: 0;
    padding: 30px;
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f6f9;
    color: #222;
}

/* Top Controls Container */
.top-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Headings */
h2 {
    margin-bottom: 15px;
    font-weight: 600;
}

h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #222;
    border-bottom: 2px solid #4f46e5;
    padding-bottom: 10px;
}

/* Control Card */
.control-panel {
    background: white;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    flex: 1;
    min-width: 300px;
}

/* Rate Display */
.rate-display {
    background: white;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    min-width: 200px;
}

.rate-display h2 {
    margin-bottom: 10px;
}

.rate-value {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fc 0%, #f0f2f8 100%);
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.rate-number {
    font-size: 32px;
    font-weight: 700;
    color: #4f46e5;
    letter-spacing: -0.5px;
}

.rate-unit {
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
}

/* Input */
input[type="number"] {
    width: 120px;
    padding: 8px 10px;
    font-size: 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    margin-right: 10px;
    outline: none;
    transition: border-color 0.2s ease;
}

input[type="number"]:focus {
    border-color: #4f46e5;
}

/* Button */
button {
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: #4f46e5;
    color: white;
    transition: background 0.2s ease, transform 0.1s ease;
}

button:hover {
    background: #4338ca;
}

button:active {
    transform: scale(0.97);
}

/* Main Container - Chart + Right Panel */
.main-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Chart Container */
#chart-container {
    background: white;
    padding: 20px;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
    width: 900px;
    max-width: 100%;
    height: 600px;
}

/* Right Panel */
.right-panel {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-box,
.delete-box {
    background: white;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

/* Database Count Display */
.db-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: linear-gradient(135deg, #f8f9fc 0%, #f0f2f8 100%);
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.db-count .label {
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.db-count .count {
    font-size: 28px;
    font-weight: 700;
    color: #4f46e5;
    letter-spacing: -0.5px;
}

/* Delete Box Styling */
.delete-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.delete-box input[type="number"] {
    width: 100%;
    margin-right: 0;
    margin-bottom: 15px;
}

.delete-btn {
    width: 100%;
    padding: 11px 16px;
    background: #ef4444;
    font-weight: 600;
}

.delete-btn:hover {
    background: #dc2626;
}

/* Modal Overlay */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 15% auto;
    padding: 30px 35px;
    border-radius: 14px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}

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

.modal-content h3 {
    color: #ef4444;
    font-size: 20px;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 12px;
}

.modal-content p {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    margin: 15px 0 25px 0;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-btn,
.cancel-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
}

.confirm-btn {
    background: #ef4444;
}

.confirm-btn:hover {
    background: #dc2626;
}

.cancel-btn {
    background: #6b7280;
}

.cancel-btn:hover {
    background: #4b5563;
}

/* Footer / Small Text */
small {
    color: #666;
}

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

    .right-panel {
        width: 100%;
        max-width: 900px;
        flex-direction: row;
    }

    .info-box,
    .delete-box {
        flex: 1;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .top-controls {
        flex-direction: column;
    }

    #chart-container {
        padding: 15px;
        height: 400px;
    }

    .right-panel {
        flex-direction: column;
    }

    .modal-content {
        margin: 25% auto;
        padding: 25px;
    }
}

@media (max-width: 480px) {
    .modal-buttons {
        flex-direction: column-reverse;
    }

    .confirm-btn,
    .cancel-btn {
        width: 100%;
    }
}