// ============================================
// Station Details Page Styles
// ============================================

// Variables
$primary: #4361ee;
$primary-dark: #3a56d4;
$success: #10b981;
$warning: #f59e0b;
$danger: #ef4444;
$info: #0ea5e9;
$gray-50: #f8fafc;
$gray-100: #f1f5f9;
$gray-200: #e2e8f0;
$gray-300: #cbd5e1;
$gray-400: #94a3b8;
$gray-500: #64748b;
$gray-600: #475569;
$gray-700: #334155;
$gray-800: #1e293b;
$white: #ffffff;

$gradient-primary: linear-gradient(135deg, $primary 0%, #764ba2 100%);
$gradient-success: linear-gradient(135deg, $success 0%, #059669 100%);
$gradient-warning: linear-gradient(135deg, $warning 0%, #d97706 100%);
$gradient-info: linear-gradient(135deg, $info 0%, #0284c7 100%);

$shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
$shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
$shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
$shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

$transition-base: all 0.3s ease;
$border-radius-lg: 1rem;
$border-radius-md: 0.75rem;
$border-radius-sm: 0.5rem;

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

// ============================================
// Main Container
// ============================================
.station-details-page {
    padding: 1.5rem;
    background: $gray-50;
    min-height: 100vh;
    animation: fadeIn 0.4s ease-out;
    
    @media (max-width: 768px) {
        padding: 1rem;
    }
}

// ============================================
// Header Section
// ============================================
.station-header {
    background: $white;
    border-radius: $border-radius-lg;
    margin-bottom: 1.5rem;
    box-shadow: $shadow-md;
    transition: $transition-base;
    
    &:hover {
        box-shadow: $shadow-lg;
    }
}

.station-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    
    @media (max-width: 768px) {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

.station-name {
    font-size: 1.75rem;
    font-weight: 700;
    background: $gradient-primary;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    
    @media (max-width: 768px) {
        font-size: 1.5rem;
    }
}

.station-location {
    color: $gray-500;
    font-size: 0.875rem;
    
    i {
        color: $primary;
        margin-right: 0.25rem;
    }
    
    .station-code-separator {
        margin: 0 0.5rem;
        color: $gray-300;
    }
}

.station-actions {
    display: flex;
    gap: 0.75rem;
    
    @media (max-width: 768px) {
        width: 100%;
        justify-content: center;
    }
}

// ============================================
// Button Styles
// ============================================
.btn-primary-custom {
    background: $gradient-primary;
    color: $white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: $border-radius-sm;
    font-weight: 500;
    transition: $transition-base;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    
    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba($primary, 0.4);
        color: $white;
    }
    
    i {
        font-size: 0.875rem;
    }
}

.btn-secondary-custom {
    background: $white;
    color: $gray-700;
    border: 1px solid $gray-300;
    padding: 0.6rem 1.25rem;
    border-radius: $border-radius-sm;
    font-weight: 500;
    transition: $transition-base;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    
    &:hover {
        background: $gray-50;
        border-color: $gray-400;
        transform: translateY(-2px);
    }
}

// ============================================
// Stats Grid - INLINE CARDS (4 columns)
// ============================================
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    
    @media (max-width: 992px) {
        grid-template-columns: repeat(2, 1fr);
    }
    
    @media (max-width: 576px) {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    border-radius: $border-radius-lg;
    overflow: hidden;
    transition: $transition-base;
    cursor: pointer;
    
    &:hover {
        transform: translateY(-4px);
        box-shadow: $shadow-xl;
        
        .stat-icon {
            transform: scale(1.1);
            opacity: 0.5;
        }
    }
    
    &-body {
        padding: 1.25rem;
    }
    
    &-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    &-primary {
        background: $gradient-primary;
        color: $white;
    }
    
    &-success {
        background: $gradient-success;
        color: $white;
    }
    
    &-warning {
        background: $gradient-warning;
        color: $gray-800;
        
        .stat-value, .stat-title, .stat-subtitle {
            color: $gray-800;
        }
    }
    
    &-info {
        background: $gradient-info;
        color: $white;
    }
}

.stat-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-subtitle {
    font-size: 0.7rem;
    opacity: 0.8;
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.3;
    transition: $transition-base;
}

// ============================================
// Main Tabs Card
// ============================================
.main-tabs-card {
    background: $white;
    border-radius: $border-radius-lg;
    overflow: hidden;
    box-shadow: $shadow-md;
}

.tabs-header {
    background: $white;
    border-bottom: 1px solid $gray-200;
    overflow-x: auto;
    
    &::-webkit-scrollbar {
        height: 4px;
    }
    
    &::-webkit-scrollbar-track {
        background: $gray-100;
    }
    
    &::-webkit-scrollbar-thumb {
        background: $gray-400;
        border-radius: 4px;
    }
}

.tabs-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0 1rem;
    gap: 0.25rem;
    min-width: max-content;
}

.tab-item {
    .tab-link {
        border: none;
        background: none;
        padding: 1rem 1.25rem;
        color: $gray-600;
        font-weight: 500;
        font-size: 0.875rem;
        transition: $transition-base;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: relative;
        
        @media (max-width: 768px) {
            padding: 0.75rem 1rem;
            font-size: 0.75rem;
        }
        
        i {
            font-size: 0.875rem;
        }
        
        .tab-badge {
            background: $gray-200;
            color: $gray-700;
            padding: 0.25rem 0.5rem;
            border-radius: 20px;
            font-size: 0.65rem;
            margin-left: 0.5rem;
        }
        
        &:hover {
            color: $primary;
            background: $gray-50;
        }
        
        &.active {
            color: $primary;
            
            &::after {
                content: '';
                position: absolute;
                bottom: 0;
                left: 0;
                right: 0;
                height: 3px;
                background: $gradient-primary;
                border-radius: 3px 3px 0 0;
            }
        }
    }
}

.tabs-content {
    padding: 1.5rem;
    background: $gray-50;
    
    @media (max-width: 768px) {
        padding: 1rem;
    }
}

// ============================================
// Info Cards - INLINE (2 columns)
// ============================================
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    
    @media (max-width: 768px) {
        grid-template-columns: 1fr;
    }
}

.info-card {
    background: $white;
    border-radius: $border-radius-md;
    padding: 1.25rem;
    box-shadow: $shadow-sm;
    transition: $transition-base;
    
    &:hover {
        box-shadow: $shadow-md;
    }
    
    &-title {
        font-size: 1rem;
        font-weight: 600;
        color: $gray-800;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 2px solid $gray-200;
        position: relative;
        
        &::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 40px;
            height: 2px;
            background: $gradient-primary;
        }
        
        i {
            color: $primary;
            margin-right: 0.5rem;
        }
    }
}

.info-table {
    .info-row {
        display: flex;
        padding: 0.5rem 0;
        border-bottom: 1px solid $gray-100;
        
        &:last-child {
            border-bottom: none;
        }
    }
    
    .info-label {
        width: 120px;
        font-weight: 600;
        color: $gray-600;
        font-size: 0.875rem;
    }
    
    .info-value {
        flex: 1;
        color: $gray-800;
        font-size: 0.875rem;
    }
}

.address-card {
    background: $white;
    border-radius: $border-radius-md;
    padding: 1.25rem;
    box-shadow: $shadow-sm;
    
    .address-title {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
        
        i {
            color: $primary;
            margin-right: 0.5rem;
        }
    }
    
    .address-text {
        color: $gray-600;
        line-height: 1.6;
        margin: 0;
    }
}

// ============================================
// Data Tables
// ============================================
.data-table-wrapper {
    background: $white;
    border-radius: $border-radius-md;
    overflow-x: auto;
    box-shadow: $shadow-sm;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    
    thead {
        background: $gray-50;
        
        th {
            padding: 1rem;
            font-size: 0.8rem;
            font-weight: 600;
            color: $gray-700;
            text-align: left;
            border-bottom: 2px solid $gray-200;
        }
    }
    
    tbody {
        tr {
            transition: $transition-base;
            border-bottom: 1px solid $gray-100;
            
            &:hover {
                background: rgba($primary, 0.03);
            }
            
            &.row-warning {
                background: rgba($warning, 0.05);
            }
            
            &.row-expiring {
                background: rgba($warning, 0.08);
            }
        }
        
        td {
            padding: 0.875rem 1rem;
            font-size: 0.8rem;
            color: $gray-700;
            
            code {
                background: $gray-100;
                padding: 0.25rem 0.5rem;
                border-radius: 6px;
                font-size: 0.75rem;
            }
        }
    }
}

// ============================================
// Status Badges
// ============================================
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    
    &.status-active, &.status-paid {
        background: $gradient-success;
        color: $white;
    }
    
    &.status-expired, &.status-overdue {
        background: $gradient-warning;
        color: $white;
    }
    
    &.status-pending {
        background: $gradient-warning;
        color: $white;
    }
    
    &.status-upcoming {
        background: $gradient-info;
        color: $white;
    }
}

// ============================================
// Action Buttons
// ============================================
.action-btn {
    padding: 0.4rem 0.75rem;
    border-radius: $border-radius-sm;
    font-size: 0.7rem;
    font-weight: 500;
    transition: $transition-base;
    cursor: pointer;
    border: none;
    background: $info;
    color: $white;
    
    &:hover {
        background: darken($info, 10%);
        transform: scale(1.05);
    }
}

// ============================================
// Providers Grid - INLINE (2 columns)
// ============================================
.providers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    
    @media (max-width: 768px) {
        grid-template-columns: 1fr;
    }
}

.provider-card {
    background: $white;
    border-radius: $border-radius-lg;
    overflow: hidden;
    box-shadow: $shadow-sm;
    transition: $transition-base;
    
    &:hover {
        box-shadow: $shadow-md;
    }
    
    &-header {
        padding: 1rem 1.25rem;
        
        h5 {
            margin: 0;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        &.provider-header-internet {
            background: $gradient-primary;
            color: $white;
        }
        
        &.provider-header-vendor {
            background: $gradient-success;
            color: $white;
        }
    }
    
    &-body {
        padding: 1rem;
    }
}

.provider-item {
    border: 1px solid $gray-200;
    border-radius: $border-radius-md;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: $transition-base;
    
    &:last-child {
        margin-bottom: 0;
    }
    
    &:hover {
        border-color: $primary;
        box-shadow: $shadow-sm;
    }
    
    &-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        
        h6 {
            margin: 0;
            font-size: 0.875rem;
        }
    }
}

.provider-details {
    font-size: 0.75rem;
    color: $gray-600;
    
    div {
        margin-bottom: 0.25rem;
    }
    
    .detail-label {
        font-weight: 600;
        width: 70px;
        display: inline-block;
    }
}

.provider-actions {
    margin-top: 0.75rem;
}

// ============================================
// Empty States
// ============================================
.empty-state {
    text-align: center;
    padding: 3rem;
    background: $white;
    border-radius: $border-radius-md;
    
    .empty-icon {
        font-size: 3rem;
        color: $gray-400;
        margin-bottom: 1rem;
    }
    
    p {
        color: $gray-500;
        margin: 0;
    }
}

// ============================================
// Loading Spinner
// ============================================
.loading-spinner {
    text-align: center;
    padding: 3rem;
    
    .spinner {
        width: 48px;
        height: 48px;
        border: 3px solid $gray-200;
        border-top-color: $primary;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        margin: 0 auto 1rem;
    }
}

// ============================================
// Modal Styles
// ============================================
.modal-content {
    border: none;
    border-radius: $border-radius-lg;
    overflow: hidden;
    
    .modal-header {
        background: $gradient-primary;
        color: $white;
        border: none;
        padding: 1rem 1.5rem;
        
        .btn-close {
            filter: brightness(0) invert(1);
            opacity: 0.8;
            transition: $transition-base;
            
            &:hover {
                opacity: 1;
                transform: rotate(90deg);
            }
        }
    }
    
    .modal-body {
        padding: 1.5rem;
        max-height: 70vh;
        overflow-y: auto;
    }
}

// ============================================
// Responsive Breakpoints
// ============================================
@media (max-width: 768px) {
    .data-table {
        thead {
            display: none;
        }
        
        tbody {
            tr {
                display: block;
                margin-bottom: 1rem;
                border: 1px solid $gray-200;
                border-radius: $border-radius-md;
            }
            
            td {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 0.75rem;
                
                &::before {
                    content: attr(data-label);
                    font-weight: 600;
                    color: $gray-600;
                    font-size: 0.7rem;
                }
            }
        }
    }
    
    .info-table .info-row {
        flex-direction: column;
        
        .info-label {
            width: 100%;
            margin-bottom: 0.25rem;
        }
    }
}

// ============================================
// Print Styles
// ============================================
@media print {
    .station-details-page {
        padding: 0;
        background: $white;
    }
    
    .station-actions,
    .action-btn,
    .modal {
        display: none !important;
    }
    
    .stat-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid $gray-300;
    }
    
    .main-tabs-card {
        box-shadow: none;
        border: 1px solid $gray-300;
    }
}