/* Button Component Styles */

/* Base button styles */
.btn,
button[type="submit"],
button[type="button"],
input[type="submit"],
input[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    border-radius: var(--radius-base);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--font-weight-medium);
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    vertical-align: middle;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    min-height: 44px; /* 터치 타겟 최소 크기 */
}

/* Button ripple effect */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Button variants */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-hover) 0%, var(--secondary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    position: relative;
    z-index: 1;
}

.btn-outline::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: var(--primary);
    z-index: -1;
    transition: width var(--transition-fast);
}

.btn-outline:hover {
    color: white;
}

.btn-outline:hover::after {
    width: 100%;
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border: 2px solid transparent;
}

.btn-ghost:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-primary);
}

/* Button with icon */
.btn i,
.btn svg {
    font-size: 1.1em;
    width: 1.1em;
    height: 1.1em;
}

/* Button sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    min-height: 36px;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--text-lg);
    min-height: 52px;
}

.btn-xl {
    padding: 1.25rem 2.5rem;
    font-size: var(--text-xl);
    min-height: 60px;
}

/* Full width button */
.btn-block {
    display: flex;
    width: 100%;
}

/* Button states */
.btn:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Icon buttons */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.btn-icon.btn-sm {
    width: 36px;
    height: 36px;
}

.btn-icon.btn-lg {
    width: 52px;
    height: 52px;
}

/* Button groups */
.btn-group {
    display: inline-flex;
    border-radius: var(--radius-base);
    overflow: hidden;
}

.btn-group .btn {
    border-radius: 0;
    margin: 0;
}

.btn-group .btn:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* Loading state */
.btn-loading {
    color: transparent;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-top-color: transparent;
    animation: button-loading-spinner 0.8s linear infinite;
}

@keyframes button-loading-spinner {
    from { transform: rotate(0turn); }
    to { transform: rotate(1turn); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: calc(var(--text-base) * 0.95);
    }
    
    .btn-sm {
        padding: 0.375rem 0.875rem;
        font-size: calc(var(--text-sm) * 0.95);
    }
    
    .btn-lg {
        padding: 0.875rem 1.75rem;
        font-size: calc(var(--text-lg) * 0.95);
    }
    
    /* 모바일에서 버튼 그룹은 세로로 */
    .btn-group-responsive {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-responsive .btn {
        width: 100%;
        border-radius: var(--radius-base);
        margin-bottom: var(--space-xs);
    }
    
    .btn-group-responsive .btn:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: calc(var(--text-base) * 0.9);
        min-height: 40px;
    }
    
    /* 작은 화면에서는 버튼을 전체 너비로 */
    .btn-responsive {
        width: 100%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 터치 디바이스에서는 호버 효과 제거 */
    .btn:hover {
        transform: none;
    }
    
    /* 터치 시 피드백 강화 */
    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
}

/* Dark mode adjustments */
[data-theme="dark"] .btn-outline {
    border-color: var(--primary);
    color: var(--primary);
}

[data-theme="dark"] .btn-ghost:hover {
    background-color: var(--bg-secondary);
}

/* Accessibility */
.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:focus:not(:focus-visible) {
    outline: none;
}

/* Print styles */
@media print {
    .btn {
        border: 1px solid currentColor;
        color: black;
        background: white;
    }
}