/* VPS Responsive Design - PC & Mobile Optimized */


/* === PASSWORD FIELD STYLES === */

.password-field {
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.password-field:hover {
    background: #f8f9fa !important;
    border-color: #667eea !important;
}

.password-hidden {
    color: #6c757d;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.password-visible {
    color: #495057;
    font-family: 'Courier New', monospace;
}

.password-field::after {
    content: 'Click để hiện/ẩn mật khẩu';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    font-size: 10px;
    color: #6c757d;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.password-field:hover::after {
    opacity: 1;
}


/* === BASE STYLES === */

.vps-container {
    width: 100%;
    max-width: 100%;
}

#vps-table-body {
    width: 100%;
    max-width: 100%;
}


/* === PC LAYOUT (Desktop) === */

@media (min-width: 992px) {
    .vps-container {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
        gap: 20px;
        margin-top: 20px;
        width: 100%;
        max-width: 100%;
    }
    .vps-card {
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        transition: all 0.3s ease;
        width: 100%;
        max-width: 100%;
    }
    .vps-card:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        transform: translateY(-2px);
    }
    .vps-card-header {
        color: white;
        padding: 15px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    /* Background khác nhau cho từng loại dịch vụ */
    .vps-card-vps .vps-card-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    .vps-card-hosting .vps-card-header {
        background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    }
    .vps-card-email .vps-card-header {
        background: linear-gradient(135deg, #ff6b6b 0%, #ffa8a8 100%);
    }
    .vps-card-title {
        font-size: 1.1em;
        font-weight: 600;
        margin: 0;
    }
    .vps-status-badges {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    .vps-card-body {
        padding: 20px;
    }
    .vps-info-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 20px;
    }
    /* Responsive grid cho 8 items */
    @media (min-width: 1200px) {
        .vps-info-grid {
            grid-template-columns: repeat(4, 1fr);
        }
    }
    @media (min-width: 992px) and (max-width: 1199px) {
        .vps-info-grid {
            grid-template-columns: repeat(3, 1fr);
        }
    }
    /* Grid riêng cho phần VPS Status - luôn 3 cột */
    .vps-status-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    @media (max-width: 991px) {
        .vps-status-grid {
            grid-template-columns: repeat(2, 1fr) !important;
        }
    }
    @media (max-width: 576px) {
        .vps-status-grid {
            grid-template-columns: repeat(1, 1fr) !important;
        }
    }
    .vps-info-item {
        display: flex;
        flex-direction: column;
        gap: 5px;
        padding: 5px;
        border-radius: 6px;
        font-size: 12px;
    }
    .vps-info-label {
        font-size: 0.85em;
        color: #666;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .vps-info-value {
        font-size: 0.95em;
        color: #333;
        font-weight: 500;
    }
    .vps-info-value.copy-text {
        cursor: pointer;
        padding: 4px 8px;
        background: #f8f9fa;
        border-radius: 4px;
        transition: background 0.2s;
    }
    .vps-info-value.copy-text:hover {
        background: #e9ecef;
    }
    /* Badge loại dịch vụ */
    .vps-info-value .badge {
        font-size: 0.8em;
        padding: 6px 10px;
        border-radius: 6px;
        font-weight: 500;
    }
    .vps-info-value .badge.bg-primary {
        background: linear-gradient(135deg, #007bff, #0056b3) !important;
    }
    .vps-info-value .badge.bg-success {
        background: linear-gradient(135deg, #28a745, #1e7e34) !important;
    }
    .vps-info-value .badge.bg-info {
        background: linear-gradient(135deg, #17a2b8, #138496) !important;
    }
    .vps-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 15px;
    }
    .vps-action-btn {
        padding: 8px 12px;
        font-size: 0.85em;
        border-radius: 6px;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    .vps-action-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    .vps-action-btn.btn-sm {
        padding: 6px 10px;
        font-size: 0.8em;
    }
    /* Action button colors */
    .vps-action-btn.btn-warning {
        background: #ffc107;
        color: #000;
    }
    .vps-action-btn.btn-secondary {
        background: #6c757d;
        color: #fff;
    }
    .vps-action-btn.btn-success {
        background: #28a745;
        color: #fff;
    }
    .vps-action-btn.btn-dark {
        background: #343a40;
        color: #fff;
    }
    .vps-action-btn.btn-primary {
        background: #007bff;
        color: #fff;
    }
    .vps-action-btn.btn-info {
        background: #17a2b8;
        color: #fff;
    }
    .vps-action-btn.btn-outline-info {
        background: transparent;
        color: #17a2b8;
        border: 1px solid #17a2b8;
    }
}


/* === MOBILE LAYOUT (Tablet & Phone) === */

@media (max-width: 991px) {
    .vps-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 15px;
        width: 100%;
    }
    .vps-card {
        background: #fff;
        border: 1px solid #e0e0e0;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        overflow: hidden;
        width: 100%;
        max-width: 100%;
    }
    .vps-card-header {
        color: white;
        padding: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    /* Background khác nhau cho từng loại dịch vụ - Mobile */
    .vps-card-vps .vps-card-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    .vps-card-hosting .vps-card-header {
        background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    }
    .vps-card-email .vps-card-header {
        background: linear-gradient(135deg, #ff6b6b 0%, #ffa8a8 100%);
    }
    .vps-card-title {
        font-size: 1.1em;
        font-weight: 600;
        margin: 0;
    }
    .vps-status-badges {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }
    .vps-card-body {
        padding: 15px;
    }
    .vps-info-stack {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }
    /* Mobile responsive cho 8 items */
    @media (max-width: 576px) {
        .vps-info-stack {
            /* grid-template-columns: 1fr; */
        }
    }
    .vps-info-item {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 10px;
        background: #f8f9fa;
        border-radius: 8px;
    }
    .vps-info-label {
        font-size: 0.8em;
        color: #666;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    .vps-info-value {
        font-size: 0.9em;
        color: #333;
        font-weight: 500;
    }
    .vps-info-value.copy-text {
        cursor: pointer;
        padding: 6px 10px;
        background: #fff;
        border-radius: 6px;
        border: 1px solid #dee2e6;
        transition: all 0.2s;
    }
    .vps-info-value.copy-text:active {
        background: #e9ecef;
        transform: scale(0.98);
    }
    .vps-actions {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 15px;
    }
    .vps-action-btn {
        padding: 12px 8px;
        font-size: 0.85em;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        min-height: 44px;
        /* Touch-friendly minimum size */
    }
    .vps-action-btn:active {
        transform: scale(0.95);
    }
    /* Action button colors for mobile */
    .vps-action-btn.btn-warning {
        background: #ffc107;
        color: #000;
    }
    .vps-action-btn.btn-secondary {
        background: #6c757d;
        color: #fff;
    }
    .vps-action-btn.btn-success {
        background: #28a745;
        color: #fff;
    }
    .vps-action-btn.btn-dark {
        background: #343a40;
        color: #fff;
    }
    .vps-action-btn.btn-primary {
        background: #007bff;
        color: #fff;
    }
    .vps-action-btn.btn-info {
        background: #17a2b8;
        color: #fff;
    }
    .vps-action-btn.btn-outline-info {
        background: transparent;
        color: #17a2b8;
        border: 1px solid #17a2b8;
    }
}


/* === EXTRA SMALL MOBILE === */

@media (max-width: 576px) {
    .vps-actions {
        /* grid-template-columns: 1fr; */
        gap: 5px;
    }
    .vps-action-btn {
        padding: 14px 12px;
        font-size: 0.9em;
        min-height: 48px;
    }
    .vps-card-header {
        padding: 12px;
    }
    .vps-card-body {
        padding: 12px;
    }
}


/* === ANIMATIONS === */

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vps-card {
    animation: slideInUp 0.3s ease-out;
}


/* === LOADING STATES === */

.vps-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.vps-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}


/* === UTILITY CLASSES === */

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-text {
    position: relative;
}

.copy-text::after {
    content: '📋';
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s;
}

.copy-text:hover::after {
    opacity: 1;
}


/* === DARK MODE SUPPORT === */


/* Dark mode được bật thủ công */

body.dark-mode .vps-card {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .vps-info-item {
    background: #4a5568;
}

body.dark-mode .vps-info-value.copy-text {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

body.dark-mode .vps-info-label {
    color: #a0aec0;
}


/* === SERVICE TYPE STYLING === */


/* Border và shadow khác nhau theo loại dịch vụ */

.vps-card-vps {
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.vps-card-hosting {
    border-left: 4px solid #56ab2f;
    box-shadow: 0 2px 8px rgba(86, 171, 47, 0.2);
}

.vps-card-email {
    border-left: 4px solid #ff6b6b;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

.vps-card-vps:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.vps-card-hosting:hover {
    box-shadow: 0 4px 16px rgba(86, 171, 47, 0.3);
}

.vps-card-email:hover {
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

/* VPS Modal - Responsive Layout */
@media (max-width: 768px) {
    .vps-price-summary .row {
        flex-direction: column;
    }
    
    .vps-price-summary .col-md-9,
    .vps-price-summary .col-md-3 {
        width: 100%;
        max-width: 100%;
    }
    
    .vps-submit-wrapper {
        margin-top: 1rem;
    }
    
    .vps-submit-wrapper button {
        min-height: 60px;
        font-size: 1rem;
        padding: 0.875rem 1.25rem;
    }
    
    .balance-alert-compact {
        margin-top: 1rem;
        min-height: auto;
    }
    
    .balance-alert-content {
        padding: 0.75rem;
    }
    
    .balance-alert-content i {
        font-size: 1.25rem;
    }
    
    .balance-alert-title {
        font-size: 0.8rem;
    }
    
    .balance-alert-amount {
        font-size: 0.85rem;
    }
    
    .balance-alert-amount strong {
        font-size: 0.95rem;
    }
    
    .price-summary-card .row {
        flex-direction: column;
        gap: 0.75rem !important;
    }
    
    .price-summary-card .col-md-4,
    .price-summary-card .col-md-6,
    .price-summary-card .col-6,
    .price-summary-card .col-4,
    .price-summary-card .col-12 {
        width: 100%;
        max-width: 100%;
    }
    
    .summary-info-compact {
        min-height: 45px;
        padding: 0.4rem;
    }
    
    .summary-info-value-small {
        font-size: 0.8rem;
    }
    
    .price-item-compact {
        min-height: 45px;
        padding: 0.4rem;
    }
    
    .price-value-small {
        font-size: 0.85rem;
    }
    
    .price-value-total {
        font-size: 0.95rem;
    }
    
    .vps-config-section .row {
        flex-direction: column;
    }
    
    .vps-config-section .col-md-7,
    .vps-config-section .col-md-5 {
        width: 100%;
        max-width: 100%;
    }
}