/* Excel-like Professional Client Area Styles */

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* Excel Header */
.excel-header {
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    padding: 8px 12px;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.client-info-bar {
    display: flex;
    align-items: center;
    height: 32px;
}

.client-avatar {
    width: 28px;
    height: 28px;
    background: #0078d4;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

.client-avatar i {
    color: white;
    font-size: 14px;
}

.client-details {
    display: flex;
    align-items: center;
    gap: 15px;
}

.client-name {
    font-weight: 600;
    color: #323130;
}

.client-id {
    color: #605e5c;
    font-size: 12px;
}

.client-status {
    background: #107c10;
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 500;
}

.quick-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    height: 32px;
}

.action-btn {
    background: transparent;
    color: #0078d4;
    padding: 4px 12px;
    border: 1px solid #0078d4;
    border-radius: 2px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: #0078d4;
    color: white;
    text-decoration: none;
}

.balance-display {
    background: #fff3cd;
    color: #856404;
    padding: 4px 8px;
    border: 1px solid #ffeaa7;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 600;
}

/* Excel Search Bar */
.excel-search-bar {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    padding: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.excel-search-bar form {
    margin: 0;
}

.search-input {
    flex: 1;
    border: 1px solid #8a8886;
    border-radius: 2px;
    padding: 6px 10px;
    font-size: 13px;
    margin-right: 6px;
    outline: none;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.search-btn {
    background: #0078d4;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.search-btn:hover {
    background: #106ebe;
}

/* Excel Stats Grid */
.excel-stats-grid {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: #dee2e6;
}

.stat-cell {
    background: white;
    transition: background-color 0.15s ease;
}

.stat-cell:hover {
    background: #f3f2f1;
}

.stat-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.stat-link:hover {
    text-decoration: none;
    color: inherit;
}

.stat-icon {
    width: 32px;
    height: 32px;
    background: #f3f2f1;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: 16px;
    color: #605e5c;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    color: #605e5c;
    margin-bottom: 2px;
    font-weight: 500;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #323130;
    line-height: 1.2;
}

/* Excel Panels */
.excel-panels {
    margin-top: 16px;
}

.panels-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-full-width {
    width: 100%;
}

.panels-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panels-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.excel-panel {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.panel-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #323130;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-badge {
    background: #0078d4;
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 500;
}

.panel-action {
    background: #0078d4;
    color: white;
    padding: 4px 12px;
    border-radius: 2px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.15s ease;
}

.panel-action:hover {
    background: #106ebe;
    color: white;
    text-decoration: none;
}

.panel-body {
    padding: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #323130;
}

.panel-list {
    border-top: 1px solid #f3f2f1;
}

.list-item {
    display: block;
    border-bottom: 1px solid #f3f2f1;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.list-item:hover {
    background: #f3f2f1;
    text-decoration: none;
    color: inherit;
}

.list-item.active {
    background: #deecf9;
    border-left: 3px solid #0078d4;
}

.item-content {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.item-content i {
    margin-right: 8px;
    color: #605e5c;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.item-label {
    flex: 1;
    color: #323130;
}

.item-badge {
    background: #d13438;
    color: white;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
}

.panel-footer {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 10px 16px;
    font-size: 12px;
    color: #605e5c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .client-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .quick-actions {
        justify-content: flex-start;
        margin-top: 8px;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .panels-row {
        grid-template-columns: 1fr;
    }
    
    .excel-search-bar form {
        flex-direction: column;
        gap: 8px;
    }
    
    .search-input {
        margin-right: 0;
    }
}

@media (max-width: 576px) {
    .excel-header {
        padding: 6px 8px;
    }
    
    .client-info-bar {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        gap: 8px;
    }
    
    .stat-cell {
        min-height: 80px;
    }
    
    .stat-link {
        padding: 8px 12px;
    }
    
    .panel-header {
        padding: 8px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .panel-body {
        padding: 12px;
    }
    
    .item-content {
        padding: 8px 12px;
    }
}

/* Print Styles */
@media print {
    .excel-header,
    .excel-search-bar,
    .panel-action,
    .action-btn {
        display: none;
    }
    
    .excel-panel {
        break-inside: avoid;
        margin-bottom: 16px;
    }
    
    .panels-row {
        display: block;
    }
    
    .panels-col {
        display: block;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .excel-header,
    .excel-panel,
    .excel-table {
        border-width: 2px;
        border-color: #000;
    }
    
    .stat-cell:hover,
    .list-item:hover,
    .excel-table tbody tr:hover {
        background: #000;
        color: #fff;
    }
    
    .excel-table th {
        background: #000;
        color: #fff;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Focus Styles for Accessibility */
.action-btn:focus,
.search-btn:focus,
.panel-action:focus,
.stat-link:focus,
.list-item:focus {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
}

.search-input:focus {
    outline: none;
}

/* Excel-like Tables */
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
}

.excel-table th,
.excel-table td {
    border: 1px solid #d1d1d1;
    padding: 6px 10px;
    text-align: left;
    vertical-align: middle;
}

.excel-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #323130;
    position: relative;
    user-select: none;
}

.excel-table th.sortable {
    cursor: pointer;
    padding-right: 25px;
}

.excel-table th.sortable:hover {
    background: #e1e1e1;
}

.excel-table th .sort-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
}

.excel-table th.sort-asc .sort-indicator {
    border-bottom: 6px solid #605e5c;
    opacity: 1;
}

.excel-table th.sort-desc .sort-indicator {
    border-top: 6px solid #605e5c;
    opacity: 1;
}

.excel-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.excel-table tbody tr:hover {
    background: #e1e1e1;
}

.excel-table tbody tr.selected {
    background: #deecf9;
    border-left: 3px solid #0078d4;
}

.excel-table td.number {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.excel-table td.currency {
    text-align: right;
    font-weight: 600;
}

.excel-table td.status {
    text-align: center;
}

.excel-table .status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.excel-table .status-active {
    background: #dff6dd;
    color: #107c10;
}

.excel-table .status-pending {
    background: #fff4ce;
    color: #797673;
}

.excel-table .status-suspended {
    background: #fde7e9;
    color: #d13438;
}

/* Keyboard Navigation */
.keyboard-focus {
    outline: 2px solid #0078d4;
    outline-offset: 2px;
    z-index: 1;
}

/* Enhanced Panel Features */
.excel-panel.expanded {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    max-width: none;
    max-height: none;
    overflow: auto;
}

.excel-panel.expanded .panel-header {
    position: sticky;
    top: 0;
    z-index: 1001;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px 0;
    z-index: 2000;
    min-width: 150px;
}

.context-menu-item {
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: #323130;
}

.context-menu-item:hover {
    background: #f3f2f1;
}

.context-menu-separator {
    height: 1px;
    background: #dee2e6;
    margin: 4px 0;
}

/* Loading States */
.excel-panel.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.excel-panel.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f2f1;
    border-top: 2px solid #0078d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1002;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Data Visualization */
.data-bar {
    height: 4px;
    background: #f3f2f1;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.data-bar-fill {
    height: 100%;
    background: #0078d4;
    transition: width 0.3s ease;
}

.data-bar-fill.success {
    background: #107c10;
}

.data-bar-fill.warning {
    background: #ffb900;
}

.data-bar-fill.danger {
    background: #d13438;
}

/* Compact Mode */
.excel-panel.compact .panel-header {
    padding: 6px 12px;
    min-height: 32px;
}

.excel-panel.compact .panel-body {
    padding: 8px 12px;
}

.excel-panel.compact .item-content {
    padding: 6px 12px;
}

.excel-panel.compact .panel-title {
    font-size: 12px;
}

/* Mobile Optimizations */
@media (max-width: 576px) {
    .excel-table {
        font-size: 11px;
    }
    
    .excel-table th,
    .excel-table td {
        padding: 4px 6px;
    }
    
    .excel-panel.expanded {
        top: 10px;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
    
    .context-menu {
        min-width: 120px;
    }
    
    .context-menu-item {
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Print Optimizations */
@media print {
    .excel-panel {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .excel-table {
        font-size: 10px;
    }
    
    .excel-table th,
    .excel-table td {
        border: 1px solid #000;
        padding: 2px 4px;
    }
    
    .sort-indicator,
    .panel-action,
    .action-btn {
        display: none;
    }
}