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

:root {
    /* Default theme colors (Pastel Blue) */
    --primary-color: #B8D8E8;
    --secondary-color: #E8B8D8;
    --tertiary-color: #D8E8B8;
    --quaternary-color: #E8D8B8;
    --quinary-color: #D8B8E8;
    --senary-color: #B8E8D8;
    --septenary-color: #E8C8B8;
    --octonary-color: #C8B8E8;
    --nonary-color: #B8E8C8;
    --denary-color: #E8B8C8;
    
    /* Default font sizes */
    --font-size-base: 14px;
    --font-size-small: 12px;
    --font-size-large: 16px;
    --font-size-title: 28px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    padding: 20px;
    font-size: var(--font-size-base);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.top-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 25px;
    padding-bottom: 10px;
}

.controls-container {
    display: flex;
    align-items: center;
    gap: 0;
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
}

.control-select {
    border: none;
    background: transparent;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s ease;
}

.control-select:hover {
    color: #111827;
    background: #f9fafb;
    border-radius: 4px;
}

.control-select:focus {
    outline: none;
    background: #f3f4f6;
    border-radius: 4px;
}

.theme-select {
    min-width: 160px;
}

.theme-select option {
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 600;
}

.control-divider {
    width: 1px;
    height: 20px;
    background: #e5e7eb;
    margin: 0 8px;
}

.font-size-controls {
    display: flex;
    gap: 4px;
}

.rotation-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
}

.rotation-label {
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.rotation-slider {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.rotation-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.rotation-slider::-webkit-slider-thumb:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.rotation-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.rotation-slider::-moz-range-thumb:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.font-btn {
    border: none;
    background: transparent;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.font-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.control-btn {
    border: none;
    background: transparent;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #374151;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.clear-btn:hover {
    background: #fee;
    color: #dc2626;
}

h1 {
    font-size: var(--font-size-title);
    color: #1f2937;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 600;
}

.main-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 30px;
    width: 100%;
    max-width: 1400px;
}

.input-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    max-height: 750px;
}

.input-panel h2 {
    font-size: 20px;
    color: #1f2937;
    margin-bottom: 20px;
    font-weight: 600;
}

.input-panel h3 {
    font-size: var(--font-size-large);
    color: #374151;
    margin-top: 25px;
    margin-bottom: 15px;
    font-weight: 600;
}

.data-entry-form {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.key-input,
.value-input,
.unit-input {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
    min-width: 0;
}

.key-input {
    flex: 2;
    max-width: 140px;
}

.value-input {
    flex: 1;
    width: 70px;
    max-width: 80px;
}

.unit-input {
    flex: 1;
    width: 50px;
    max-width: 60px;
}

.key-input:focus,
.value-input:focus,
.unit-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(184, 216, 232, 0.2);
}

.add-btn {
    padding: 8px 12px;
    background: var(--primary-color);
    color: #1f2937;
    border: none;
    border-radius: 6px;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.add-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.data-list-container {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.data-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}

.data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
    cursor: move;
    user-select: none;
}

.data-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.data-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.data-item.drag-over {
    border-color: var(--primary-color);
    background: #f0f9ff;
}

.data-item-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-item-label {
    font-weight: 600;
    color: #1f2937;
    font-size: var(--font-size-base);
}

.data-item-value {
    color: #6b7280;
    font-weight: 500;
    font-size: var(--font-size-base);
}

.data-item-visibility {
    background: transparent;
    border: none;
    color: #059669;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.data-item-visibility:hover {
    background: #d1fae5;
}

.data-item-delete {
    background: transparent;
    border: none;
    color: #dc2626;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
}

.data-item-delete:hover {
    background: #fee;
}

.data-item-edit {
    background: transparent;
    border: none;
    color: #2563eb;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s ease;
    margin-right: 4px;
}

.data-item-edit:hover {
    background: #eff6ff;
}

.data-item-actions {
    display: flex;
    gap: 0;
}

.chart-panel {
    background: white;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chart-container {
    width: 100%;
    max-width: 1400px;
    height: 750px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-info {
    margin-top: 5px;
    text-align: center;
    color: #6b7280;
    font-size: var(--font-size-base);
}

.chart-info p {
    margin: 5px 0;
}

/* Scrollbar styling */
.data-list::-webkit-scrollbar {
    width: 8px;
}

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

.data-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.data-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.2s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 24px;
}

.modal-field {
    margin-bottom: 20px;
}

.modal-field:last-child {
    margin-bottom: 0;
}

.modal-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(184, 216, 232, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
}

.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel {
    background: #f3f4f6;
    color: #374151;
}

.modal-btn-cancel:hover {
    background: #e5e7eb;
}

.modal-btn-save {
    background: var(--primary-color);
    color: #1f2937;
}

.modal-btn-save:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 400px;
    }
}

/* Theme-specific adjustments */
body.theme-applied {
    transition: background-color 0.3s ease;
}

.add-btn.theme-applied,
.control-btn.theme-applied,
.font-btn.theme-applied {
    transition: all 0.3s ease;
}
