/* 业余无线电主题 - 组件样式库 */

/* ========================================
   1. 按钮组件
   ======================================== */

/* 主要按钮 */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, #1a5f7a 0%, #134b5f 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(26, 95, 122, 0.35);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(26, 95, 122, 0.45);
    background: linear-gradient(135deg, #2d8fb4 0%, #1a5f7a 100%);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 95, 122, 0.35);
}

.btn-secondary {
    background: linear-gradient(135deg, #e8a838 0%, #c78c22 100%);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(232, 168, 56, 0.35);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(232, 168, 56, 0.45);
    background: linear-gradient(135deg, #f5c86b 0%, #e8a838 100%);
}

.btn-outline {
    background: transparent;
    border: 2px solid #1a5f7a;
    color: #1a5f7a;
}

.btn-outline:hover {
    background: #1a5f7a;
    color: #ffffff;
    transform: translateY(-2px);
}

/* 按钮尺寸 */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 1.125rem 2.5rem;
    font-size: 1.125rem;
    border-radius: 16px;
}

/* ========================================
   2. 表单组件
   ======================================== */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.125rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #2d3748;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #1a5f7a;
    box-shadow: 0 0 0 4px rgba(26, 95, 122, 0.1);
}

.form-control::placeholder {
    color: #a0aecb;
}

.form-control:disabled {
    background-color: #f7fafc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 输入框状态 */
.is-valid {
    border-color: #27ae60;
}

.is-invalid {
    border-color: #e74c3c;
}

.invalid-feedback {
    display: none;
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* ========================================
   3. 徽章组件
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 9999px;
    transition: all 0.3s ease;
}

.badge-primary {
    background: linear-gradient(135deg, #1a5f7a, #134b5f);
    color: #ffffff;
}

.badge-secondary {
    background: linear-gradient(135deg, #e8a838, #c78c22);
    color: #ffffff;
}

.badge-success {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    color: #ffffff;
}

.badge-warning {
    background: linear-gradient(135deg, #f39c12, #d68910);
    color: #ffffff;
}

.badge-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #ffffff;
}

.badge-info {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #ffffff;
}

/* ========================================
   4. 头像组件
   ======================================== */

.avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #1a5f7a, #134b5f);
    border-radius: 50%;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

.avatar-xl {
    width: 96px;
    height: 96px;
    font-size: 2rem;
}

.avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 头像状态指示器 */
.avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background-color: #27ae60;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

/* ========================================
   5. 列表组件
   ======================================== */

.list-group {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
}

.list-group-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.list-group-item:first-child {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.list-group-item:last-child {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.list-group-item:hover {
    background-color: #f7fafc;
    transform: translateX(8px);
}

.list-group-item.active {
    background: linear-gradient(135deg, #1a5f7a, #134b5f);
    color: #ffffff;
    border-color: #1a5f7a;
}

/* ========================================
   6. 进度条组件
   ======================================== */

.progress {
    display: flex;
    height: 8px;
    overflow: hidden;
    background-color: #e2e8f0;
    border-radius: 9999px;
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #ffffff;
    text-align: center;
    white-space: nowrap;
    background: linear-gradient(90deg, #1a5f7a, #2d8fb4);
    transition: width 0.6s ease;
    border-radius: 9999px;
}

.progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

/* ========================================
   7. 警告提示组件
   ======================================== */

.alert {
    position: relative;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.alert-primary {
    background-color: rgba(26, 95, 122, 0.1);
    border-color: rgba(26, 95, 122, 0.2);
    color: #134b5f;
}

.alert-success {
    background-color: rgba(39, 174, 96, 0.1);
    border-color: rgba(39, 174, 96, 0.2);
    color: #1e8449;
}

.alert-warning {
    background-color: rgba(243, 156, 18, 0.1);
    border-color: rgba(243, 156, 18, 0.2);
    color: #d68910;
}

.alert-danger {
    background-color: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

.alert:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   8. 模态框组件
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #2d3748;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ========================================
   9. 工具提示组件
   ======================================== */

.tooltip {
    position: absolute;
    z-index: 9999;
    display: inline-block;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    background-color: #2d3748;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tooltip::before {
    content: '';
    position: absolute;
    border: 6px solid transparent;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* 工具提示位置 */
.tooltip-top::before {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #2d3748;
}

.tooltip-bottom::before {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: #2d3748;
}

.tooltip-left::before {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: #2d3748;
}

.tooltip-right::before {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: #2d3748;
}

/* ========================================
   10. 加载状态组件
   ======================================== */

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(26, 95, 122, 0.1);
    border-top-color: #1a5f7a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.spinner-lg {
    width: 64px;
    height: 64px;
    border-width: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background-color: #1a5f7a;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ========================================
   11. 分割线组件
   ======================================== */

.divider {
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        #e2e8f0,
        transparent
    );
    margin: 2rem 0;
}

.divider-vertical {
    width: 1px;
    height: auto;
    background: linear-gradient(
        to bottom,
        transparent,
        #e2e8f0,
        transparent
    );
    margin: 0 2rem;
}

/* ========================================
   12. 响应式适配
   ======================================== */

@media (max-width: 768px) {
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .form-control {
        padding: 0.75rem 1rem;
    }
    
    .modal-content {
        margin: 1rem;
    }
    
    .avatar {
        width: 40px;
        height: 40px;
    }
}
