/**
 * MartCode Modal History - Navigation Controls CSS
 * Bootstrap 3.3.7 Compatible
 * @version 2.1.1
 */

/* ============================================================================
   Navigation Controls Container
   ============================================================================ */

.mc-modal-nav-controls {
    display: inline-block;
    vertical-align: middle;
}

/* Ensure buttons are inline in modal header */
.modal-header .mc-modal-nav-controls {
    margin-right: 10px;
    margin-top: 0;
    margin-bottom: 0;
}

/* ============================================================================
   Navigation Buttons
   ============================================================================ */

.mc-modal-back,
.mc-modal-forward {
    /* Bootstrap 3 btn overrides */
    padding: 5px 10px;
    font-size: 13px;
    line-height: 1.5;
    border-radius: 3px;
    
    /* Transition for smooth state changes */
    transition: all 0.2s ease-in-out;
}

/* Button icons */
.mc-modal-back .fa,
.mc-modal-forward .fa {
    margin-right: 0;
    font-size: 14px;
}

/* ============================================================================
   Button States
   ============================================================================ */

/* Disabled state */
.mc-modal-back:disabled,
.mc-modal-forward:disabled,
.mc-modal-back.disabled,
.mc-modal-forward.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hover state (only when enabled) */
.mc-modal-back:not(:disabled):hover,
.mc-modal-forward:not(:disabled):hover {
    background-color: #357ebd;
    border-color: #285e8e;
    color: #fff;
}

/* Active/pressed state */
.mc-modal-back:not(:disabled):active,
.mc-modal-forward:not(:disabled):active {
    box-shadow: inset 0 3px 5px rgba(0,0,0,.125);
}

/* Focus state (for keyboard navigation) */
.mc-modal-back:focus,
.mc-modal-forward:focus {
    outline: thin dotted;
    outline: 5px auto -webkit-focus-ring-color;
    outline-offset: -2px;
}

/* ============================================================================
   Hidden State
   ============================================================================ */

.mc-modal-back.hidden,
.mc-modal-forward.hidden,
.mc-modal-nav-controls.hidden {
    display: none !important;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

/* Mobile optimization */
@media (max-width: 767px) {
    .mc-modal-nav-controls {
        margin-bottom: 5px;
        display: block;
        width: 100%;
    }
    
    .mc-modal-back,
    .mc-modal-forward {
        width: 48%;
        margin: 0 1%;
    }
}

/* Tablet */
@media (min-width: 768px) and (max-width: 991px) {
    .mc-modal-back,
    .mc-modal-forward {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* ============================================================================
   Modal Header Integration
   ============================================================================ */

/* Ensure proper alignment in modal header */
.modal-header {
    position: relative;
}

.modal-header .pull-left {
    float: left !important;
}

.modal-header .modal-title {
    margin: 0;
    line-height: 1.42857143;
}

/* Adjust close button to not overlap with nav controls */
.modal-header .close {
    margin-top: -2px;
    float: right;
}

/* ============================================================================
   Button Group Styling (if buttons are grouped)
   ============================================================================ */

.btn-group > .mc-modal-back,
.btn-group > .mc-modal-forward {
    position: relative;
    float: left;
}

/* Remove margin between grouped buttons */
.btn-group > .mc-modal-back:not(:first-child),
.btn-group > .mc-modal-forward:not(:first-child) {
    margin-left: -1px;
}

/* Round first button */
.btn-group > .mc-modal-back:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Round last button */
.btn-group > .mc-modal-forward:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* ============================================================================
   Loading State (Optional)
   ============================================================================ */

.mc-modal-back.loading,
.mc-modal-forward.loading {
    position: relative;
    color: transparent;
}

.mc-modal-back.loading::after,
.mc-modal-forward.loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mc-button-spin 0.6s linear infinite;
}

@keyframes mc-button-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   Accessibility
   ============================================================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mc-modal-back,
    .mc-modal-forward {
        border-width: 2px;
    }
    
    .mc-modal-back:disabled,
    .mc-modal-forward:disabled {
        opacity: 0.6;
        text-decoration: line-through;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mc-modal-back,
    .mc-modal-forward {
        transition: none;
    }
}

/* ============================================================================
   Dark Mode Support (Optional)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .mc-modal-back,
    .mc-modal-forward {
        background-color: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .mc-modal-back:hover,
    .mc-modal-forward:hover {
        background-color: #34495e;
        border-color: #3d566e;
    }
}

/* ============================================================================
   Debug Mode
   ============================================================================ */

.mc-debug-mode .mc-modal-back,
.mc-debug-mode .mc-modal-forward {
    border: 2px dashed #e74c3c;
}

.mc-debug-mode .mc-modal-back::before,
.mc-debug-mode .mc-modal-forward::before {
    content: "DEBUG";
    position: absolute;
    top: -15px;
    left: 0;
    font-size: 9px;
    color: #e74c3c;
    font-weight: bold;
}

/* ============================================================================
   Print Styles
   ============================================================================ */

@media print {
    .mc-modal-nav-controls,
    .mc-modal-back,
    .mc-modal-forward {
        display: none !important;
    }
}
