/* Socroom Unified Button System */
/* Based on Design System Specifications */

/* Button Reset */
.btn {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Core Button Base */
.btn {
    /* Auto layout */
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;

    /* Typography */
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;

    /* Transitions */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    flex: none;
    flex-grow: 0;
    box-sizing: border-box;

    /* Interaction */
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(53, 116, 217, 0.3);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

/* Button Sizes */
.btn-xs {
    padding: 6px 12px;
    height: 28px;
    min-width: 52px;
    border-radius: 8px;
    font-size: 12px;
    gap: 6px;
}

.btn-sm {
    padding: 10px 16px;
    height: 36px;
    min-width: 68px;
    border-radius: 9px;
    font-size: 13px;
    gap: 6px;
}

.btn-md {
    padding: 14px 16px;
    height: 48px;
    min-width: 82px;
    border-radius: 10px;
    font-size: 14px;
    gap: 8px;
}

.btn-lg {
    padding: 16px 24px;
    height: 52px;
    min-width: 96px;
    border-radius: 12px;
    font-size: 15px;
    gap: 8px;
}

.btn-xl {
    padding: 20px 32px;
    height: 60px;
    min-width: 120px;
    border-radius: 14px;
    font-size: 16px;
    gap: 10px;
    font-weight: 600;
    position: relative;
    z-index: 101; /* 다른 요소들보다 위에 표시 */
}

/* Button Variants */

/* Primary Button */
.btn-primary {
    background: #3574d9;
    color: white;
    border: 1px solid #3574d9;
    box-shadow: 0 2px 8px rgba(53, 116, 217, 0.15);
}

.btn-primary:hover:not(:disabled) {
    background: #2a5bb8;
    border-color: #2a5bb8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(53, 116, 217, 0.25);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(53, 116, 217, 0.2);
}

/* Secondary Button */
.btn-secondary {
    background: #f8f9fa;
    color: #374151;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover:not(:disabled) {
    background: #ffffff;
    border-color: #3574d9;
    color: #3574d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(53, 116, 217, 0.1);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(53, 116, 217, 0.08);
}

/* Ghost/Transparent Button */
.btn-ghost {
    background: transparent;
    color: #374151;
    border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: rgba(53, 116, 217, 0.05);
    color: #3574d9;
    border-color: rgba(53, 116, 217, 0.1);
}

.btn-ghost:active:not(:disabled) {
    background: rgba(53, 116, 217, 0.08);
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: #3574d9;
    border: 1px solid #3574d9;
}

.btn-outline:hover:not(:disabled) {
    background: #3574d9;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(53, 116, 217, 0.2);
}

.btn-outline:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(53, 116, 217, 0.15);
}

/* Danger Button */
.btn-danger {
    background: #ef4444;
    color: white;
    border: 1px solid #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.25);
}

.btn-danger:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

/* Success Button */
.btn-success {
    background: #10b981;
    color: white;
    border: 1px solid #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
}

.btn-success:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

/* Button Icon */
.btn-icon {
    font-size: 1em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-left {
    order: -1;
}

.btn-icon-right {
    order: 1;
}

/* Button Full Width */
.btn-full {
    width: 100%;
    min-width: 100%;
}

/* Button Block (fills container) */
.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* Button Group */
.btn-group {
    display: inline-flex;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.btn-group .btn {
    border-radius: 0;
    border-right: none;
}

.btn-group .btn:first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    border-right: 1px solid;
}

/* Loading State */
.btn-loading {
    pointer-events: none;
    position: relative;
}

.btn-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: btn-spin 0.8s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

@keyframes btn-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .btn-xl {
        padding: 16px 24px;
        height: 52px;
        font-size: 15px;
    }

    .btn-lg {
        padding: 14px 20px;
        height: 48px;
        font-size: 14px;
    }

    .btn-md {
        padding: 12px 16px;
        height: 44px;
        font-size: 14px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .btn-secondary {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }

    .btn-secondary:hover:not(:disabled) {
        background: #4b5563;
        border-color: #3574d9;
    }

    .btn-ghost {
        color: #f9fafb;
    }

    .btn-ghost:hover:not(:disabled) {
        background: rgba(53, 116, 217, 0.1);
        color: #60a5fa;
    }
}

/* Legacy Button Compatibility Classes */
.primary-button {
    /* Inherit from btn btn-primary btn-md */
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: none;
    flex-grow: 0;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 14px 16px;
    height: 48px;
    min-width: 82px;
    border-radius: 10px;
    background: #3574d9;
    color: white;
    border: 1px solid #3574d9;
    box-shadow: 0 2px 8px rgba(53, 116, 217, 0.15);
    cursor: pointer;
    text-decoration: none;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.secondary-button {
    /* Inherit from btn btn-secondary btn-md */
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: none;
    flex-grow: 0;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 14px 16px;
    height: 48px;
    min-width: 82px;
    border-radius: 10px;
    background: #f8f9fa;
    color: #374151;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    text-decoration: none;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.apple-primary-button {
    /* Inherit from btn btn-primary btn-xl */
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: none;
    flex-grow: 0;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 20px 32px;
    height: 60px;
    min-width: 120px;
    border-radius: 14px;
    background: #3574d9;
    color: white;
    border: 1px solid #3574d9;
    box-shadow: 0 2px 8px rgba(53, 116, 217, 0.15);
    cursor: pointer;
    text-decoration: none;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Legacy compatibility for existing styles */
.primary-button:hover:not(:disabled),
.apple-primary-button:hover:not(:disabled) {
    background: #2a5bb8;
    border-color: #2a5bb8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(53, 116, 217, 0.25);
}

.secondary-button:hover:not(:disabled) {
    background: #ffffff;
    border-color: #3574d9;
    color: #3574d9;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(53, 116, 217, 0.1);
}

/* Special Button Styles */
.btn-elevated {
    box-shadow: 0 4px 14px rgba(53, 116, 217, 0.15);
}

.btn-elevated:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(53, 116, 217, 0.25);
}

.btn-flat {
    box-shadow: none;
    border: none;
}

.btn-flat:hover:not(:disabled) {
    transform: none;
    box-shadow: none;
}