/* static/css/style.css */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
}

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

.edit-btn {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

/* 导航卡片网格 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;  /* 移除链接的默认下划线 */
    color: inherit;        /* 继承颜色 */
}

.card:hover {
    transform: translateY(-5px);
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    pointer-events: none;  /* 防止内部元素影响点击 */
}

.card-image-container {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.card img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.card-title {
    color: #333;
    font-weight: bold;
    margin-top: 10px;
    font-size: 1.1em;
}

.port {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

/* 编辑页面样式 */
.edit-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-container {
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.link-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 编辑页面的图片容器 */
.link-image-container {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    border-radius: 4px;
    background-color: #f8f9fa;
    overflow: hidden;
}

/* 编辑页面的图片 */
.link-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.link-info {
    flex-grow: 1;
    margin-right: 15px;
}

.link-info input {
    margin-bottom: 8px;
    width: 100%;
}

.link-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.drag-handle {
    cursor: move;
    color: #666;
    margin-right: 10px;
    padding: 10px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .link-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .link-image-container {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }

    .link-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }
}

.location-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #666;
    min-height: 24px;
}

.location-details {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ip-address {
    color: #444;
    font-family: monospace;
    padding: 2px 6px;
    background: #f5f5f5;
    border-radius: 3px;
    margin-right: 8px;
}

.country-flag {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    vertical-align: middle;
    object-fit: cover;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 添加加载动画效果 */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

#country-name:empty,
#country-name:contains('获取中...'),
#ip-address:empty,
#ip-address:contains('获取中...') {
    animation: pulse 1.5s infinite;
}

/* 添加到现有的 style.css */
.error-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #f8f9fa;
}

.error-content {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.error-icon {
    font-size: 48px;
    margin: 20px 0;
}

.error-message {
    margin: 20px 0;
    color: #666;
    line-height: 1.6;
}

.error-details {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9em;
}

.ip-address {
    font-family: monospace;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
}

.error-actions {
    margin-top: 30px;
}

.error-actions .btn {
    padding: 10px 20px;
    font-size: 16px;
}