/* General Container */
#kis-stock-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 960px;
    margin: 20px auto;
}

/* Input Form Styles */
#kis-stock-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Stock List Grid - More compact */
.kis-stock-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

/* New Card Design - More compact */
.kis-stock-card {
    position: relative;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Delete Button Styles */
.delete-stock-button {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
    font-weight: bold;
}

.kis-stock-card:hover .delete-stock-button {
    opacity: 1;
}

.delete-stock-button:hover {
    background-color: #d93025;
}

.kis-stock-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.08);
    background-color: #f0f9f4; /* 연한 녹색 */
}

/* Card Header - Reduced spacing */
.card-header {
    border-bottom: 1px solid #f1f3f5;
    padding-bottom: 6px;
    margin-bottom: 6px;
    text-align: left;
}

.stock-name {
    font-size: 16px;
    margin: 0 0 2px 0;
}

.stock-code {
    font-size: 13px;
}

.stock-code-container {
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-button {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    background-color: #6c757d;
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.info-button:hover {
    background-color: #007bff;
    color: #fff;
}

/* Card Body - Reduced spacing */
.card-body {
    display: flex;
    align-items: baseline;
    gap: 6px;
    text-align: left;
    margin-bottom: 8px;
}

.current-price {
    font-size: 22px;
    font-weight: 700;
    color: #343a40; /* Default color */
    margin: 0;
    line-height: 1;
}

.price-change {
    font-size: 14px;
    font-weight: 600;
}

.price-change.price-up,
.current-price.price-up {
    color: #d93025; /* Red for price up */
}

.price-change.price-down,
.current-price.price-down {
    color: #1971c2; /* Blue for price down */
}

.current-price span {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-left: 3px;
}

/* Card Footer - Reduced font size */
.card-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 6px;
    text-align: left;
    font-size: 10px;
    color: #495057;
}

.price-detail {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.detail-label {
    font-size: 10px;
    color: #868e96;
}

.price-detail.limit-up .high-price {
    color: #d93025; /* Red for limit up */
}

.price-detail.limit-down .low-price {
    color: #1971c2; /* Blue for limit down */
}

.prev-price, .high-price, .low-price, .trade-volume {
    font-weight: 600;
}

/* Error Message inside Card */
.card-error {
    text-align: center;
    padding: 15px;
}

.card-error strong {
    font-size: 14px;
    color: #d93025;
}

.card-error p {
    font-size: 12px;
    color: #495057;
    margin-top: 6px;
}

#kis-save-stock-button {
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#kis-save-stock-button:hover {
    background-color: #0056b3;
}

.edit-input {
    width: 100%;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.9em;
}

/* --- List View Styles --- */
.kis-stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.kis-stock-table th, .kis-stock-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e9ecef;
    text-align: right;
    vertical-align: middle;
}

.kis-stock-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    text-align: center;
}

.kis-stock-table .stock-name-code {
    text-align: left;
}

.kis-stock-table .stock-name-code strong {
    font-size: 15px;
    font-weight: 600;
}

.kis-stock-table .stock-name-code small {
    font-size: 12px;
    color: #868e96;
}

.kis-stock-table .price-change small {
    display: block;
    font-size: 12px;
}

.kis-stock-table .delete-stock-button {
    position: static;
    opacity: 1;
    background-color: #dc3545;
    width: 24px;
    height: 24px;
    line-height: 24px;
    font-size: 16px;
    vertical-align: middle;
}

.kis-stock-table .info-button {
    margin-left: 8px;
    vertical-align: middle;
}

.actions-cell {
    text-align: center !important;
}

.kis-stock-table .delete-stock-button:hover {
    background-color: #c82333;
}

.kis-stock-row.price-up .current-price,
.kis-stock-row.price-up .price-change {
    color: #d93025; /* Red for price up */
}

.kis-stock-row.price-down .current-price,
.kis-stock-row.price-down .price-change {
    color: #1971c2; /* Blue for price down */
}

.kis-stock-row.price-up {
    background-color: rgba(217, 48, 37, 0.05);
}

.kis-stock-row.price-down {
    background-color: rgba(25, 113, 194, 0.05);
}