/* IVR Enhancement Styles - Mobile & Desktop Optimized */

/* Base responsive utilities */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ivr-node {
    position: relative;
}

.ivr-options {
    padding-left: 20px;
}

/* Responsive card statistics */
.card.bg-primary .card-body h4,
.card.bg-success .card-body h4,
.card.bg-warning .card-body h4,
.card.bg-info .card-body h4 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.card.bg-primary .card-body small,
.card.bg-success .card-body small,
.card.bg-warning .card-body small,
.card.bg-info .card-body small {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    opacity: 0.9;
    line-height: 1.2;
}

/* Mobile-optimized recording status */
#recording-status {
    font-weight: bold;
    padding: clamp(8px, 2vw, 15px);
    border-radius: 8px;
    background-color: #f8f9fa;
    text-align: center;
    font-size: clamp(0.9rem, 2.5vw, 1rem);
}

/* Responsive queue status badges */
.badge.bg-warning,
.badge.bg-success,
.badge.bg-info {
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.5rem, 1.5vw, 0.6rem);
    white-space: nowrap;
}

/* Responsive agent table enhancements */
.table th {
    border-top: none;
    font-weight: 600;
    background-color: #f8f9fa;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    padding: clamp(0.5rem, 1.5vw, 0.75rem);
}

.table td {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    padding: clamp(0.5rem, 1.5vw, 0.75rem);
    vertical-align: middle;
}

/* Mobile-optimized table wrapper */
.table-responsive {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* IVR Menu Builder responsive styles */
.ivr-menu-tree {
    max-height: clamp(300px, 60vh, 500px);
    overflow-y: auto;
    padding: 0.5rem;
}

.ivr-menu-tree .card {
    border-left: 4px solid #007bff;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ivr-menu-tree .card-body {
    padding: clamp(1rem, 3vw, 1.5rem);
}

/* Mobile-friendly input groups */
.input-group {
    margin-bottom: 0.75rem;
}

.input-group .form-control {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    padding: clamp(0.5rem, 1.5vw, 0.75rem);
}

.input-group-text {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    padding: clamp(0.5rem, 1.5vw, 0.75rem);
    min-width: clamp(2.5rem, 8vw, 3rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive analytics chart containers */
#calls-chart,
#duration-chart {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: clamp(1rem, 3vw, 1.5rem);
    width: 100%;
    height: auto;
    min-height: clamp(200px, 40vw, 300px);
}

/* Enhanced responsive button groups */
.btn-group-vertical .btn {
    margin-bottom: clamp(3px, 1vw, 8px);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.8rem, 2vw, 1rem);
    white-space: nowrap;
}

.btn-group-vertical .btn:last-child {
    margin-bottom: 0;
}

/* Mobile-optimized buttons */
.btn {
    touch-action: manipulation;
    user-select: none;
}

.btn-lg {
    font-size: clamp(1rem, 3vw, 1.25rem);
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2rem);
}

.btn-sm {
    font-size: clamp(0.75rem, 2vw, 0.875rem);
    padding: clamp(0.25rem, 1vw, 0.375rem) clamp(0.5rem, 1.5vw, 0.75rem);
}

/* IVR Tab specific responsive styles */
#ivr .alert-info {
    border-left: 4px solid #17a2b8;
    background-color: #e7f3ff;
    padding: clamp(1rem, 3vw, 1.5rem);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

/* Enhanced record button with mobile optimization */
#record-btn {
    min-width: clamp(180px, 40vw, 250px);
    min-height: clamp(50px, 12vw, 70px);
    font-size: clamp(1rem, 3vw, 1.2rem);
    border-radius: 12px;
    transition: all 0.3s ease;
}

#record-btn.btn-secondary {
    animation: recording-pulse 1.5s infinite;
}

#record-btn:active {
    transform: scale(0.98);
}

@keyframes recording-pulse {
    0% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(108, 117, 125, 0.7);
    }
    50% { 
        opacity: 0.8; 
        box-shadow: 0 0 0 10px rgba(108, 117, 125, 0);
    }
    100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(108, 117, 125, 0);
    }
}

/* Responsive queue statistics styling */
.d-flex.justify-content-between {
    padding: clamp(8px, 2vw, 12px) 0;
    border-bottom: 1px solid #eee;
    align-items: center;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
}

.d-flex.justify-content-between:last-child {
    border-bottom: none;
}

/* Mobile-specific optimizations */
@media (max-width: 767.98px) {
    /* Stack cards vertically on mobile */
    .row .col-md-3 {
        margin-bottom: 1rem;
    }
    
    /* Optimize agent table for mobile */
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }
    
    /* Hide less important table columns on mobile */
    .table th:nth-child(n+5),
    .table td:nth-child(n+5) {
        display: none;
    }
    
    /* Mobile-friendly IVR menu builder */
    .ivr-menu-tree {
        max-height: 60vh;
    }
    
    /* Stack form controls vertically on mobile */
    .input-group {
        flex-direction: column;
    }
    
    .input-group .input-group-text,
    .input-group .form-control,
    .input-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.5rem;
    }
    
    .input-group .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Mobile-optimized recording interface */
    #record-btn {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Improve touch targets for mobile */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Mobile analytics adjustments */
    .card.bg-primary,
    .card.bg-success,
    .card.bg-warning,
    .card.bg-info {
        margin-bottom: 1rem;
    }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Adjust card spacing for tablets */
    .card.bg-primary .card-body h4,
    .card.bg-success .card-body h4,
    .card.bg-warning .card-body h4,
    .card.bg-info .card-body h4 {
        font-size: 2rem;
    }
    
    /* Tablet-friendly table */
    .table th,
    .table td {
        padding: 0.6rem 0.4rem;
        font-size: 0.85rem;
    }
}

/* Desktop enhancements */
@media (min-width: 992px) {
    /* Enhanced hover effects for desktop */
    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        transition: all 0.2s ease;
    }
    
    .card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        transition: box-shadow 0.3s ease;
    }
    
    /* Desktop-specific table enhancements */
    .table tbody tr:hover {
        background-color: rgba(0,123,255,0.05);
        transition: background-color 0.2s ease;
    }
    
    /* Better spacing for desktop */
    .ivr-menu-tree .card-body {
        padding: 1.5rem;
    }
}

/* High resolution display optimizations */
@media (min-width: 1200px) {
    /* Larger screens get more comfortable spacing */
    .container-fluid {
        max-width: 1400px;
    }
    
    /* Enhanced typography for large screens */
    .card.bg-primary .card-body h4,
    .card.bg-success .card-body h4,
    .card.bg-warning .card-body h4,
    .card.bg-info .card-body h4 {
        font-size: 2.8rem;
    }
}

/* Dark mode support (if enabled) */
@media (prefers-color-scheme: dark) {
    #recording-status {
        background-color: #343a40;
        color: #fff;
    }
    
    .ivr-menu-tree .card {
        background-color: #495057;
        border-color: #6c757d;
    }
    
    #calls-chart,
    #duration-chart {
        background-color: #495057;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    #record-btn.btn-secondary {
        animation: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Print styles for IVR reports */
@media print {
    .btn,
    .btn-group-vertical,
    #record-btn {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .table {
        border-collapse: collapse;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
    }
}
