/* ===================================
   ACCOUNT PAGE STYLES
   Responsive for Mobile, Tablet, Desktop
   =================================== */

/* Toast Notification Styles */
.toast-notification {
    position: relative;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    padding: 16px 20px;
    margin-bottom: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
    min-width: 300px;
    max-width: 400px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: slideInRight 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-notification.success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
}

.toast-notification.error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    box-shadow: 0 8px 25px rgba(244, 67, 54, 0.3);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    font-size: 24px;
    animation: bounceIn 0.6s ease;
}

.toast-text {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.toast-message {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 12px 12px;
    animation: progressBar 4s linear;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

/* Readonly field styling */
.form-control[readonly] {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    cursor: not-allowed;
}

.form-control[readonly]:focus {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    box-shadow: none;
}

.form-text.text-muted {
    font-size: 0.875em;
    margin-top: 0.25rem;
}

.form-text.text-muted i {
    opacity: 0.7;
}

/* Order Detail Product Image Styling */
.order-item-detail img {
    transition: all 0.3s ease;
}

.order-item-detail img[src*="Logo1.png"] {
    padding: 8px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef !important;
}

.order-item-detail img[src*="Logo1.png"]:hover {
    background-color: #e9ecef;
}

/* Placeholder for product image loading */
.product-image-placeholder {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(-45deg, #f8f9fa 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f8f9fa 75%), 
                linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 4px 4px;
    background-position: 0 0, 0 2px, 2px -2px, -2px 0px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-placeholder::before {
    content: '';
    width: 24px;
    height: 24px;
    background-image: url('assets/images/Logo1.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.5;
}

/* Team Business Styles */
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.15);
}

.stat-card.bg-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.stat-card.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.stat-card.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #117a8b 100%);
}

.stat-card.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #d39e00 100%);
    color: #212529;
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.8;
}

.stat-card .stat-content h3 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1;
}

.stat-card .stat-content p {
    font-size: 0.9rem;
    margin-bottom: 0;
    opacity: 0.9;
}

.level-tabs {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 10px;
}

.level-tabs .btn-group {
    flex-wrap: nowrap;
}

.member-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.member-card:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.member-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.member-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.member-details h6 {
    margin-bottom: 5px;
    color: #333;
}

.member-details small {
    color: #6c757d;
}

.tree-level {
    margin-bottom: 30px;
}

.tree-level-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
}

.tree-level-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 20px;
}

.empty-level {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-level i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Hierarchy tree layout and click-safe layers */
.hierarchy-tree-container {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    padding: 10px 0 20px;
    -webkit-overflow-scrolling: touch;
}

.hierarchy-tree-container .hierarchy-lines-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.hierarchy-tree-container .hierarchy-content {
    position: relative;
    z-index: 5;
    min-width: max-content;
}

.hierarchy-tree-container .level-title {
    font-weight: 600;
    margin: 10px 0 6px;
}

.hierarchy-tree-container .level-nodes {
    display: flex;
    gap: 12px;
    align-items: stretch;
    padding: 6px 8px 16px;
}

.hierarchy-tree-container .tree-node {
    position: relative;
    z-index: 5;
    flex: 0 0 auto;
}

.hierarchy-tree-container .node-card {
    position: relative;
    z-index: 5;
    background: #ffffff;
    border: 1px dashed #d9dee3;
    border-radius: 12px;
    padding: 12px;
    width: 180px;
    min-height: 120px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.hierarchy-tree-container .more-node .node-card {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hierarchy-tree-container .more-node .node-card:hover {
    background: #f1f5ff;
    border-color: #b6d4fe;
}

.hierarchy-connection,
.connection-dot {
    pointer-events: none;
}

/* Mobile Horizontal Stats Scroll */
.stats-mobile-scroll {
    overflow-x: auto;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.stats-horizontal-container {
    display: flex;
    gap: 15px;
    padding: 0 5px;
    min-width: max-content;
}

.stat-item {
    flex: 0 0 auto;
    min-width: 140px;
}

.stat-card.compact {
    height: 90px;
    padding: 12px;
    min-width: 140px;
    text-align: center;
}

.stat-card.compact .stat-icon {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.stat-card.compact .stat-content h3 {
    font-size: 1.3rem;
    margin-bottom: 3px;
    line-height: 1.1;
}

.stat-card.compact .stat-content p {
    font-size: 0.75rem;
    margin-bottom: 0;
    line-height: 1.1;
}

/* Mobile scroll indicator */
.stats-mobile-scroll::after {
    content: "← Vuốt để xem thêm →";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: rgba(0,0,0,0.4);
    pointer-events: none;
    white-space: nowrap;
}

.stats-mobile-scroll.scrolled::after {
    display: none;
}

/* Mobile Tabs Navigation */
.account-mobile-tabs {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

.account-mobile-tabs .tab-btn {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 8px;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    min-width: 70px;
}

.account-mobile-tabs .tab-btn i {
    font-size: 1.2rem;
}

.account-mobile-tabs .tab-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.account-mobile-tabs .tab-btn.text-danger {
    color: #dc3545;
}

.account-mobile-tabs .tab-btn.text-danger.active {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* ===================================
   RESPONSIVE BREAKPOINTS
   =================================== */

/* Mobile (< 576px) */
@media (max-width: 575.98px) {
    .toast-notification {
        min-width: 280px;
        margin-left: 10px;
        margin-right: 10px;
    }
    
    #toast-container {
        right: 10px !important;
        left: 10px !important;
    }

    .stat-card {
        height: 100px;
        padding: 15px;
    }
    
    .stat-card .stat-content h3 {
        font-size: 1.5rem;
    }
    
    .stat-card .stat-icon {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .member-info {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .hierarchy-tree-container .node-card {
        width: 150px;
        min-height: 100px;
        padding: 10px;
    }

    .level-tabs .btn-group {
        display: flex;
        flex-wrap: nowrap;
    }
}

/* Tablet (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .stat-card {
        height: 110px;
    }

    .hierarchy-tree-container .node-card {
        width: 160px;
    }
}

/* Desktop (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .stat-card {
        height: 115px;
    }

    .stat-card .stat-content h3 {
        font-size: 1.6rem;
    }
}

/* Large Desktop (>= 992px) */
@media (min-width: 992px) {
    .account-mobile-tabs {
        display: none;
    }

    .stats-mobile-scroll {
        display: none;
    }
}

/* Keep level tabs visible above floating support/chat buttons on small screens */
@media (max-width: 767.98px) {
    #level-details .level-tabs {
        position: relative !important;
        z-index: 1075 !important;
        padding-bottom: 8px !important;
    }

    #level-details .level-tabs .btn-group {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: 6px;
    }

    #level-details .level-tabs .btn-group .btn {
        display: inline-block;
        white-space: normal;
        min-width: 110px;
        vertical-align: middle;
    }

    #team-business-section {
        padding-bottom: 150px !important;
    }
}

/* Minor styling for desktop tab layout */
.level-tabs .btn-group {
    gap: 6px;
}

/* Animation keyframes */
@keyframes fadeInOut {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes connectionDraw {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

@keyframes dotPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Node card styles */
.node-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: bold;
    color: white;
}

.node-name {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-info {
    font-size: 0.7rem;
    color: #6c757d;
    text-align: center;
    margin-bottom: 4px;
}

.node-id {
    font-size: 0.65rem;
    color: #6c757d;
    text-align: center;
}

.leader-id {
    color: #ffc107;
    font-weight: 600;
    margin-top: 2px;
}

.connection-indicator {
    font-size: 0.65rem;
    color: #007bff;
    text-align: center;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #dee2e6;
}

/* Print styles */
@media print {
    .account-mobile-tabs,
    .toast-notification,
    .btn,
    .floating-support,
    .ai-chatbot {
        display: none !important;
    }
}
