/**
 * iOS Share API Styles
 * Native share button styling
 */

/* Share button base */
.ios-share-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 500;
    color: #007AFF;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', 'Helvetica Neue', sans-serif;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
}

.ios-share-btn:hover {
    background: rgba(0, 122, 255, 0.08);
}

.ios-share-btn:active {
    background: rgba(0, 122, 255, 0.15);
    transform: scale(0.97);
}

/* Share icon */
.ios-share-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Filled variant */
.ios-share-btn-filled {
    background: #007AFF;
    color: #fff;
}

.ios-share-btn-filled:hover {
    background: #0051D5;
}

.ios-share-btn-filled:active {
    background: #004BB8;
}

/* Icon-only variant */
.ios-share-btn-icon-only {
    padding: 12px;
    border-radius: 50%;
}

.ios-share-btn-icon-only .ios-share-icon {
    width: 22px;
    height: 22px;
}

/* Compact variant */
.ios-share-btn-compact {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 32px;
    min-width: 32px;
}

.ios-share-btn-compact .ios-share-icon {
    width: 16px;
    height: 16px;
}

/* Toolbar variant (for bottom toolbars) */
.ios-share-btn-toolbar {
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    font-size: 11px;
    color: #007AFF;
    background: transparent;
}

.ios-share-btn-toolbar .ios-share-icon {
    width: 24px;
    height: 24px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ios-share-btn {
        color: #0A84FF;
    }

    .ios-share-btn:hover {
        background: rgba(10, 132, 255, 0.15);
    }

    .ios-share-btn:active {
        background: rgba(10, 132, 255, 0.25);
    }

    .ios-share-btn-filled {
        background: #0A84FF;
    }

    .ios-share-btn-filled:hover {
        background: #0A74E6;
    }

    .ios-share-btn-filled:active {
        background: #0967CC;
    }

    .ios-share-btn-toolbar {
        color: #0A84FF;
    }
}

.dark-mode .ios-share-btn {
    color: #0A84FF;
}

.dark-mode .ios-share-btn:hover {
    background: rgba(10, 132, 255, 0.15);
}

.dark-mode .ios-share-btn:active {
    background: rgba(10, 132, 255, 0.25);
}

.dark-mode .ios-share-btn-filled {
    background: #0A84FF;
}

.dark-mode .ios-share-btn-filled:hover {
    background: #0A74E6;
}

.dark-mode .ios-share-btn-filled:active {
    background: #0967CC;
}

/* Share button groups */
.ios-share-btn-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Disabled state */
.ios-share-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ios-share-btn:disabled:hover {
    background: transparent;
}

.ios-share-btn:disabled:active {
    transform: none;
}

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

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

@keyframes ios-share-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Success state animation */
.ios-share-btn-success {
    animation: ios-share-success 0.6s ease;
}

@keyframes ios-share-success {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Share menu (fallback UI) */
.ios-share-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 14px 14px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.36, 0.66, 0.04, 1);
    z-index: 12000; /* iOS system modals - highest level for system sheets */
}

.ios-share-menu-active {
    transform: translateY(0);
}

.ios-share-menu-title {
    font-size: 13px;
    font-weight: 600;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.ios-share-menu-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 16px;
}

.ios-share-menu-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ios-share-menu-option:active {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(0.95);
}

.ios-share-menu-option-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #007AFF;
    color: #fff;
    border-radius: 12px;
    font-size: 24px;
}

.ios-share-menu-option-label {
    font-size: 12px;
    color: #000;
    text-align: center;
}

/* Dark mode for share menu */
@media (prefers-color-scheme: dark) {
    .ios-share-menu {
        background: rgba(28, 28, 30, 0.95);
    }

    .ios-share-menu-title {
        color: #8E8E93;
    }

    .ios-share-menu-option:active {
        background: rgba(255, 255, 255, 0.1);
    }

    .ios-share-menu-option-icon {
        background: #0A84FF;
    }

    .ios-share-menu-option-label {
        color: #fff;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .ios-share-btn,
    .ios-share-menu,
    .ios-share-menu-option {
        transition: none;
        animation: none;
    }
}

/* Safe area support */
.ios-share-menu {
    padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom, 0px)));
}
