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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.link-generator {
    margin-bottom: 40px;
}

.input-section {
    margin-bottom: 20px;
}

.input-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.input-group input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-alias {
    margin-top: 15px;
}

.custom-alias input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.custom-alias input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

.result-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid #28a745;
}

.result-section h3 {
    color: #28a745;
    margin-bottom: 15px;
}

.result-box {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.short-url-container,
.original-url {
    margin-bottom: 15px;
}

.short-url-container label,
.original-url label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.url-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.url-display span {
    flex: 1;
    font-family: 'Courier New', monospace;
    color: #667eea;
    font-weight: 600;
}

#copyBtn {
    padding: 6px 10px;
    font-size: 14px;
    min-width: auto;
}

.original-url span {
    color: #6c757d;
    word-break: break-all;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.actions button {
    flex: 1;
    padding: 10px;
    font-size: 14px;
}

.error-section {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px;
    color: #721c24;
    margin-top: 15px;
}

.link-history {
    border-top: 2px solid #e1e5e9;
    padding-top: 30px;
}

.link-history h3 {
    margin-bottom: 20px;
    color: #555;
}

#historyList {
    margin-bottom: 20px;
}

.history-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #e1e5e9;
}

.history-item-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 8px;
}

.history-short-url {
    font-family: 'Courier New', monospace;
    color: #667eea;
    font-weight: 600;
}

.history-original-url {
    color: #6c757d;
    font-size: 14px;
    word-break: break-all;
}

.history-date {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

#clearHistoryBtn {
    background: #dc3545;
    padding: 10px 20px;
    font-size: 14px;
}

#clearHistoryBtn:hover {
    background: #c82333;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    margin-top: 20px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .url-display {
        flex-direction: column;
        align-items: stretch;
    }
    
    #copyBtn {
        align-self: center;
        min-width: 120px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-section,
.error-section {
    animation: fadeIn 0.3s ease-out;
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* 重定向错误页面样式 */
.redirect-error {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e1e5e9;
    margin: 20px 0;
}

.redirect-error h2 {
    color: #dc3545;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.redirect-error p {
    color: #6c757d;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.error-actions button {
    background: #667eea;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.error-actions button:hover {
    background: #5a67d8;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

/* IP权限控制相关样式 */
.history-item.user-link {
    border-left: 4px solid #667eea;
    background: #f8faff;
}

.history-item.other-link {
    border-left: 4px solid #e1e5e9;
    background: #f8f9fa;
    opacity: 0.8;
}

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

.user-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.other-badge {
    background: #6c757d;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

#clearHistoryBtn {
    transition: all 0.3s ease;
}

#clearHistoryBtn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 响应式调整 */
@media (max-width: 600px) {
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .user-badge,
    .other-badge {
        align-self: flex-end;
    }
} 