:root {
    --background-color: #D6D2CF;
    --card-background: #F8F7F5;
    --text-color: #333;
    --secondary-text-color: #666;
    --modal-background: white;
    --hover-background: rgba(0, 0, 0, 0.1);
    --border-color: #ccc;
    --button-background: #4facfe;
    --button-text-color: #fff;
    --positive-change: #2ecc71;
    --negative-change: #e74c3c;
    --scrollbar-track: #f1f1f1;
    --scrollbar-thumb: #888;
    --scrollbar-thumb-hover: #555;
}

body.dark-mode {
    --background-color: #1e1e1e;
    --card-background: #2b2b2b;
    --text-color: #f0f0f0;
    --secondary-text-color: #aaa;
    --modal-background: #2c2c2c;
    --hover-background: rgba(255, 255, 255, 0.1);
    --border-color: #555;
    --button-background: #1e1e1e;
    --button-text-color: #fff;
    --scrollbar-track: #333333;
    --scrollbar-thumb: #555;
    --scrollbar-thumb-hover: #777;
}

@font-face {
    font-family: "SF Pro Rounded";
    src: url("src/SF-Pro-Rounded-Regular.otf") format("opentype");
    font-weight: normal;
}

* {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-width: 240px;
}

body {
    font-family: "SF Pro Rounded", sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    user-select: none;
    direction: ltr;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 30px;
    font-weight: bold;
    margin: 0;
}

#datetime {
    font-size: 14px;
    color: var(--secondary-text-color);
    margin: 0;
    padding: 5px 10px;
    border-radius: 5px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 15px;
}

@media (min-width: 1200px) {
    .grid {
        grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    }
}

.card {
    background: var(--card-background);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 120px;
    aspect-ratio: auto;
}

.currency-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flag {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.name-and-code {
    text-align: right;
}

.name {
    font-weight: bold;
    font-size: 16px;
    margin: 0;
}

.code {
    font-size: 14px;
    color: #888;
    margin: 0;
}

.price-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.price {
    font-size: 35px;
    font-weight: bold;
    margin: 0;
}

.change {
    font-size: 18px;
    color: var(--negative-change);
    margin: 0;
}

.change.positive {
    color: var(--positive-change);
}

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

.modal-content {
    width: 20rem;
    background-color: var(--modal-background);
    padding: 15px;
    border-radius: 10px;
    position: relative;
    max-height: 80vh;
    max-width: 50rem;
    overflow-y: auto;
}

.modal-content .close+img {
    margin: 1.5rem 0 .5rem 0;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
}

.modal-content h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-content p {
    font-size: 1.5rem;
    font-weight: bold;
}

.close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 18px;
    cursor: pointer;
}

.currency-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.currency-item .flag {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

.currency-item label {
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
}

.settings-btn,
.theme-toggle-btn,
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-color);
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

@media (hover: hover) {
    .settings-btn:hover,
    .theme-toggle-btn:hover,
    .copy-btn:hover,
    .currency-item:hover,
    .reorder-btn:hover {
        background-color: var(--hover-background);
    }
}

.top-right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-content.currency-selector {
    display: flex;
    flex-direction: column;
    width: 90%;
}

.modal-content.price-modal {
    text-align: center;
    max-width: 80%;
}

#price-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 6px 0 24px 0;
}

#modal-currency-price {
    margin: 0;
}

.price-modal .change {
    margin-top: 24px;
}

.price-modal .change,
.modal-content p.code {
    font-size: 1.25rem;
}

.modal-column {
    padding: 10px;
}

.currency-list {
    max-height: 30vh;
    overflow-y: auto;
}

.no-currencies-message {
    text-align: center;
    font-size: 1.2rem;
    margin-top: 20px;
}

.currency-info-item {
    display: flex;
    align-items: center;
}

.controls {
    display: flex;
    gap: 5px;
}

.modal-section:nth-child(2) {
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-title-right {
    margin-top: 1em;
}

@media (min-width: 768px) {
    .modal-content {
        flex-direction: row !important;
    }

    .modal-column {
        width: 50%;
    }

    .modal-section:nth-child(2) {
        border-bottom: none !important;
        border-right: 1px solid var(--border-color);
    }

    .modal-title-right {
        margin-top: 0 !important;
    }
}

@media (max-width: 317px) {
    #datetime {
        display: none;
    }
}

.currency-search-box {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-color);
}

.currency-list {
    padding-top: 10px;
}

.currency-search-box {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-color);
}

.reorder-btn {
    width: 2rem;
    height: 2rem;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    border-radius: 50%;
}

.reorder-btn.remove-btn i {
    color: var(--negative-change);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

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