/* 
 * Plans CSS
 * Custom styles for the plans page
 */

/* Filter Card */
.filter-card {
    position: sticky;
    top: 20px;
    /* Removed max-height and overflow-y to allow full expansion on desktop */
    scrollbar-width: thin;
}

/* Only apply height restrictions on smaller screens if needed */
@media (max-height: 600px) {
    .filter-card {
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
}

.filter-card::-webkit-scrollbar {
    width: 6px;
}

.filter-card::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.filter-card::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.filter-card::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.filter-card .card-body {
    padding-right: 15px;
}

/* Plan Card */
.plan-card {
    transition: all 0.2s ease;
    border: 1px solid #dee2e6;
}

.plan-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.plan-card .card-header {
    background-color: #343a40;
    border-bottom: 1px solid #dee2e6;
    color: white;
}

.provider-logo {
    max-height: 30px;
    max-width: 80px;
    object-fit: contain;
    background-color: white;
    padding: 2px;
    border-radius: 4px;
}

.plan-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.plan-period {
    font-size: 0.9rem;
    color: #666;
}

/* Term Display */
.term-display {
    font-weight: bold;
    color: #495057;
    margin-left: 5px;
}

/* Data Display */
.data-display {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.data-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0d6efd;
}

.data-label {
    font-size: 0.9rem;
    color: #666;
}

/* Plan Features */
.plan-features {
    margin-top: 15px;
}

.plan-feature {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
}

.plan-feature i {
    color: #0d6efd;
    margin-right: 8px;
    margin-top: 3px;
}

/* Comparison Tray */
.comparison-tray {
    position: sticky;
    top: 20px;
}

.selected-plan-item {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    position: relative;
}

.selected-plan-item .remove-plan {
    position: absolute;
    top: 5px;
    right: 5px;
    cursor: pointer;
    color: #dc3545;
}

.selected-plan-name {
    font-weight: bold;
    margin-bottom: 5px;
    padding-right: 20px;
}

.selected-plan-price {
    color: #0d6efd;
}

/* Dropdown positioning fix */
.dropdown-menu {
    z-index: 1030;
}

/* Promotional Box */
.promo-box {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 10px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.promo-box .promo-title {
    font-weight: bold;
    color: #856404;
    margin-bottom: 5px;
}

.promo-box .promo-content {
    color: #856404;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .comparison-tray {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: auto;
        z-index: 1030;
        border-radius: 0;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .comparison-tray .card-body {
        padding: 10px;
    }
    
    .selected-plan-item {
        display: inline-block;
        margin-right: 10px;
        margin-bottom: 5px;
        padding: 5px 10px;
    }
    
    #compare-button {
        height: 38px;
    }
    
    body {
        padding-bottom: 80px;
    }
    
    .filter-card {
        max-height: none;
        overflow-y: visible;
        position: relative;
        top: 0;
    }
}


/* Enhanced Promotional Styling */
.promo-box {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    position: relative;
    overflow: hidden;
}

.promo-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffc107, #ff8c00);
}

.promo-urgent {
    background: linear-gradient(135deg, #ffe6e6 0%, #ffcccc 100%);
    border-color: #dc3545;
    animation: pulse-urgent 2s infinite;
}

.promo-urgent::before {
    background: linear-gradient(90deg, #dc3545, #ff6b6b);
}

@keyframes pulse-urgent {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.promo-title {
    font-weight: 600;
    color: #856404;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.promo-urgent .promo-title {
    color: #721c24;
}

.promo-content {
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 8px;
}

.promo-urgent .promo-content {
    color: #721c24;
}

.promo-expiry {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(133, 100, 4, 0.2);
}

.promo-urgent .promo-expiry {
    border-top-color: rgba(114, 28, 36, 0.2);
}

.promo-expiry small {
    font-size: 0.8rem;
}

/* Badge styling for urgency indicators */
.promo-title .badge {
    font-size: 0.7rem;
    padding: 4px 8px;
}

/* Network logo styling */
.network-logo {
    max-height: 20px;
    width: auto;
    object-fit: contain;
}

/* Enhanced plan card hover effects */
.plan-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Responsive promotional adjustments */
@media (max-width: 768px) {
    .promo-box {
        margin: 10px 0;
        padding: 10px;
    }
    
    .promo-title {
        font-size: 0.9rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .promo-title .badge {
        align-self: flex-end;
    }
}


/* Enhanced Term Display Styling */
.term-display {
    font-weight: 500;
    color: #495057;
    margin-left: 5px;
    font-size: 0.9rem;
}

/* Z-Index Fix for Dropdown Menus */
/* Fix for dropdown menus appearing behind other cards when hovering */

/* Ensure plan cards with hover effects maintain proper z-index */
.plan-card:hover {
    z-index: 10;
    position: relative;
}

/* Ensure dropdown menus appear above all other content */
.plan-card .dropdown-menu {
    z-index: 1050 !important;
    position: absolute !important;
}

/* Ensure the dropdown toggle button group maintains proper positioning */
.plan-card .btn-group {
    position: relative;
    z-index: 1;
}

/* Fix for Bootstrap dropdown positioning when parent has transform */
.plan-card:hover .dropdown-menu.show {
    z-index: 1060 !important;
    position: fixed !important;
}

/* Ensure dropdown menu stays visible during hover transitions */
.plan-card .dropdown-menu {
    transition: none !important;
}

/* Additional fix for dropdown menu positioning */
.dropdown-menu {
    z-index: 1050 !important;
}

/* Ensure hovered cards appear above non-hovered cards but below dropdowns */
.plan-card {
    z-index: 1;
    position: relative;
}

.plan-card:hover {
    z-index: 10;
}

/* Override any conflicting z-index from parent containers */
.plan-card .card-footer {
    position: relative;
    z-index: 2;
}

/* Ensure dropdown works properly on mobile as well */
@media (max-width: 768px) {
    .plan-card .dropdown-menu {
        z-index: 1070 !important;
        position: fixed !important;
    }
}



/* Dropdown Menu Alignment Fix */
/* Position dropdown menu under the main "View Plan" button instead of the toggle */

.plan-card .btn-group .dropdown-menu {
    /* Override Bootstrap's dropdown-menu-end positioning */
    right: auto !important;
    left: 0 !important;
    
    /* Position the dropdown to align with the start of the button group */
    transform: translateX(0) !important;
    
    /* Ensure it appears directly under the main button */
    margin-top: 0 !important;
}

/* Alternative approach: Position relative to the button group container */
.plan-card .btn-group {
    position: relative;
}

.plan-card .btn-group .dropdown-menu {
    /* Position absolutely within the button group */
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;
    
    /* Remove any default transforms that might offset the position */
    transform: none !important;
    
    /* Ensure proper spacing from the button */
    margin-top: 2px !important;
}

/* Ensure dropdown menu width doesn't exceed the button group */
.plan-card .btn-group .dropdown-menu {
    min-width: 160px;
    max-width: 200px;
}

/* Fix for mobile devices */
@media (max-width: 768px) {
    .plan-card .btn-group .dropdown-menu {
        left: 0 !important;
        right: auto !important;
        transform: none !important;
    }
}

/* Desktop Filter Panel Width Optimization */
/* Make filter panel wider and use multi-column layout on desktop */

@media (min-width: 992px) {
    /* Make filter panel content use multiple columns to reduce height */
    .filter-card .card-body {
        column-count: 2;
        column-gap: 10px;
        column-fill: balance;
    }
    
    /* Prevent filter groups from breaking across columns */
    .filter-card .mb-3,
    .filter-card .form-group {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    /* Ensure buttons stay at bottom and span full width */
    .filter-card .d-grid {
        column-span: all;
        margin-top: 1.5rem;
    }
    
    /* Alternative approach: Horizontal layout for some filters */
    .filter-card .row.filter-row {
        display: flex;
        flex-wrap: wrap;
    }
    
    .filter-card .row.filter-row .col-md-6 {
        flex: 0 0 70%;
        max-width: 50%;
    }
}

@media (min-width: 1200px) {
    /* On larger screens, use 2 columns for even better space utilization */
    .filter-card .card-body {
        column-count: 2;
        column-gap: 10px;
    }
}

/* Ensure filter card has reasonable max-height but allows scrolling if needed */
@media (min-width: 992px) {
    .filter-card {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Style improvements for multi-column layout */
.filter-card .form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.filter-card .form-select,
.filter-card .form-control {
    margin-bottom: 0.75rem;
}

/* Ensure checkboxes and features section work well in columns */
.filter-card .form-check {
    margin-bottom: 0.5rem;
}
