@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;
}

body {
    font-family: "SF Pro Rounded", sans-serif;
    background-color: #D6D2CF;
    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: #666;
    margin: 0;
    padding: 5px 10px;
    border-radius: 5px;
}

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

.card {
    background: #F8F7F5;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    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: red;
    margin: 0;
}

.change.positive {
    color: #2ecc71;
}

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

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 16px;
    width: 300px;
    max-width: 90vw;
    position: relative;
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

/* Settings Modal */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 10px;
}

.settings-label {
    font-size: 14px;
    color: #333;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: #4CAF50;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(20px);
}

/* Size Input */
.size-input {
    width: 60px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    background: #fff;
}

.size-input:focus {
    border-color: #4CAF50;
    outline: none;
}

/* Manage Cards Button */
.manage-cards-btn-container {
    justify-content: center;
    background: transparent;
    padding: 8px;
}

.manage-cards-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    background: #333;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.manage-cards-btn:hover {
    background: #444;
}

/* Manage Cards Modal */
.manage-cards-modal {
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

/* Search Container */
.search-container {
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #f8f8f8;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: #4CAF50;
    outline: none;
    background: #fff;
}

.search-input::placeholder {
    color: #999;
}

/* Currency List */
.currency-list {
    flex: 1;
    overflow-y: auto;
    max-height: 50vh;
}

.currency-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #f8f8f8;
    border-radius: 10px;
}

.currency-item-info {
    flex: 1;
}

.currency-item-info label {
    font-size: 13px;
    color: #333;
    cursor: pointer;
}

.no-results {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 20px 0;
}

#settings-btn {
    cursor: pointer;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    color: #666;
    transition: color 0.2s;
}

#settings-btn:hover {
    color: #333;
}

body.dark-mode #settings-btn {
    color: #888;
}

body.dark-mode #settings-btn:hover {
    color: #f0f0f0;
}

/* Dark Mode */
body.dark-mode {
    background-color: #1e1e1e;
    color: #f0f0f0;
}

body.dark-mode .card {
    background: #2b2b2b;
    color: #fff;
}

body.dark-mode .modal-content {
    background-color: #2c2c2c;
}

body.dark-mode .modal-header {
    border-bottom-color: #444;
}

body.dark-mode .modal-header h2 {
    color: #f0f0f0;
}

body.dark-mode .close {
    color: #888;
}

body.dark-mode .close:hover {
    color: #f0f0f0;
}

body.dark-mode .settings-item {
    background: #333;
}

body.dark-mode .settings-label {
    color: #f0f0f0;
}

body.dark-mode .size-input {
    background: #1e1e1e;
    color: #fff;
    border-color: #555;
}

body.dark-mode .size-input:focus {
    border-color: #4CAF50;
}

body.dark-mode .manage-cards-btn {
    background: #555;
}

body.dark-mode .manage-cards-btn:hover {
    background: #666;
}

body.dark-mode .search-input {
    background: #333;
    color: #fff;
    border-color: #555;
}

body.dark-mode .search-input:focus {
    background: #2c2c2c;
    border-color: #4CAF50;
}

body.dark-mode .search-input::placeholder {
    color: #888;
}

body.dark-mode .currency-item {
    background: #333;
}

body.dark-mode .currency-item-info label {
    color: #f0f0f0;
}

body.dark-mode .no-results {
    color: #888;
}