/**
 * Button System for ExamHub Theme
 * Consolidated button styles used across the theme
 */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 44px; /* Accessibility: minimum touch target */
}

.btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

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

/* Button Variants */
.btn-primary {
    background: #007cba;
    color: white;
    border: 1px solid #007cba;
}

.btn-primary:hover:not(:disabled) {
    background: #005a87;
    border-color: #005a87;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
    border-color: #545b62;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: #007cba;
    border: 2px solid #007cba;
}

.btn-outline:hover:not(:disabled) {
    background: #007cba;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    background: transparent;
    color: #6c757d;
    border: 1px solid #e2e8f0;
}

.btn-outline-secondary:hover:not(:disabled) {
    background: #f5f7fa;
    border-color: #007cba;
    color: #007cba;
    text-decoration: none;
}

.btn-success {
    background: #28a745;
    color: white;
    border: 1px solid #28a745;
}

.btn-success:hover:not(:disabled) {
    background: #1e7e34;
    border-color: #1e7e34;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    border: 1px solid #ffc107;
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
    border-color: #e0a800;
    color: #212529;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    border-color: #c82333;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-info {
    background: #17a2b8;
    color: white;
    border: 1px solid #17a2b8;
}

.btn-info:hover:not(:disabled) {
    background: #138496;
    border-color: #138496;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Premium Button with Gradient */
.btn-premium {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.btn-premium:hover:not(:disabled) {
    background: linear-gradient(135deg, #e085f7 0%, #f0495c 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    min-height: 52px;
}

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

/* Button Layout */
.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 0.75rem;
    min-width: 44px;
}

.btn-icon-sm {
    padding: 0.5rem;
    min-width: 36px;
}

.btn-icon-lg {
    padding: 1rem;
    min-width: 52px;
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: 0;
}

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

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

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

.btn-group .btn:only-child {
    border-radius: 6px;
    border-right-width: 1px;
}

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

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: btn-spinner 1s linear infinite;
}

@keyframes btn-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Special Button Effects */
.btn-gradient {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-gradient:hover::before {
    left: 100%;
}

.btn-gradient:hover:not(:disabled) {
    background: linear-gradient(135deg, #43a7fe 0%, #00e8fe 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

/* Toggle Buttons */
.btn-toggle {
    background: transparent;
    color: #666;
    border: 1px solid #e2e8f0;
}

.btn-toggle:hover:not(:disabled) {
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
}

.btn-toggle.active {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Icon Buttons with Text */
.btn i {
    font-size: 0.875em;
}

.btn-icon-left i {
    margin-right: 0.5rem;
}

.btn-icon-right i {
    margin-left: 0.5rem;
}

/* Floating Action Button */
.btn-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.btn-fab:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .btn-lg {
        padding: 0.875rem 1.75rem;
        font-size: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 0;
        border-bottom-width: 0;
        border-right-width: 1px;
    }
    
    .btn-group .btn:first-child {
        border-top-left-radius: 6px;
        border-top-right-radius: 6px;
        border-bottom-left-radius: 0;
    }
    
    .btn-group .btn:last-child {
        border-bottom-left-radius: 6px;
        border-bottom-right-radius: 6px;
        border-top-right-radius: 0;
        border-bottom-width: 1px;
    }
    
    .btn-fab {
        bottom: 1rem;
        right: 1rem;
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        min-height: 40px;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        min-height: 32px;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .btn-outline {
        border-width: 3px;
    }
    
    .btn:focus {
        outline-width: 3px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }
    
    .btn-gradient::before {
        display: none;
    }
    
    .btn-loading::after {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .btn {
        border: 1px solid #000;
        background: white !important;
        color: black !important;
        box-shadow: none;
    }
    
    .btn-fab {
        display: none;
    }
}
