/**
 * Button Components
 * 
 * All button styles including primary, secondary, danger, outline variants.
 * Follows WCAG 2.1 AA accessibility standards with proper touch targets.
 * 
 * @package Silva_Customer_Portal
 * @version 2.6.0
 */

/* ========================================
   WELCOME BANNER
   ======================================== */

.welcome-banner {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-radius: var(--card-radius);
    margin-bottom: var(--spacing-lg);
    color: white;
    box-shadow: var(--shadow-md);
}

.welcome-heading {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--spacing-xs) 0;
    color: white;
}

.welcome-message {
    font-size: var(--font-size-base);
    margin: 0;
    opacity: 0.95;
    color: rgba(255, 255, 255, 0.95);
}

/* ========================================
   BASE BUTTON STYLES
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    letter-spacing: 0.01em;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    width: auto;
    line-height: 1.5;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.btn:focus-visible {
    outline: 2px solid #014385;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(1, 67, 133, 0.1);
}

/* ========================================
   BUTTON VARIANTS
   ======================================== */

.btn-primary {
    background: linear-gradient(180deg, #014385 0%, #012f6b 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(1, 67, 133, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #01356a 0%, #012951 100%) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(1, 67, 133, 0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: #ffffff;
    color: #014385;
    border: 1px solid #d0d7e2;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
    background: #f3f7ff;
    border-color: #014385;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-danger {
    background: var(--danger-red);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-outline:hover {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue-dark);
    transform: translateY(-1px);
}

/* ========================================
   BUTTON SUB-ELEMENTS
   ======================================== */

.btn-icon {
    display: inline-block;
}

.btn-text {
    display: inline-block;
}

.btn svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.btn-primary svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.15));
}

/* ========================================
   ACTION LINKS (Dashboard Style)
   ======================================== */

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #014385;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.action-link:hover {
    background: #f3f7ff;
    color: #01356a;
    transform: translateX(2px);
}

.action-link svg {
    flex-shrink: 0;
}

/* ========================================
   BUTTON STATES
   ======================================== */

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary:disabled,
.btn-primary.disabled {
    background: #cbd5e1;
}

/* ========================================
   BUTTON SIZES
   ======================================== */

.btn-sm {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 16px;
}

/* ========================================
   LOADING STATES
   ======================================== */

.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

.btn-secondary.loading::after,
.btn-outline.loading::after {
    border-color: rgba(1, 67, 133, 0.3);
    border-top-color: #014385;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   STATUS BADGES (Improved)
   ======================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.status-badge.draft {
    background: #f3f4f6;
    color: #4b5563;
}

.status-badge.sent {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.viewed {
    background: #e0e7ff;
    color: #4338ca;
}

.status-badge.approved {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.in-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.on-hold {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.cancelled {
    background: #f3f4f6;
    color: #6b7280;
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 16px;
    line-height: 1;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.empty-state-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.empty-state .btn {
    margin-top: 8px;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Enhanced focus visible for keyboard navigation */
.btn:focus-visible,
.action-link:focus-visible {
    outline: 2px solid #014385;
    outline-offset: 2px;
}

/* Ensure minimum touch targets on mobile */
@media (max-width: 768px) {
    .btn,
    .nav-tab,
    .action-link {
        min-height: 44px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .btn-primary {
        border: 2px solid #012951;
    }
    
    .status-badge {
        border: 1px solid currentColor;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .project-card,
    .action-link {
        transition: none;
    }
    
    @keyframes btn-spin {
        to { transform: none; }
    }
}
