/**
 * Activity Table View Styles
 * Spreadsheet-like editing interface for project activities
 */

/* Container */
.activity-table-container {
    position: relative;
    min-height: 400px;
}

/* Toolbar */
.activity-table-toolbar {
    margin-bottom: 15px;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.activity-table-toolbar .btn-group {
    margin-right: 10px;
}

.activity-table-toolbar .badge {
    background-color: #5bc0de;
    margin-left: 5px;
}

/* Loading Overlay */
.activity-table-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    text-align: center;
}

.loading-spinner p {
    margin-top: 15px;
    color: #666;
    font-size: 14px;
}

/* Table Grid Container */
.activity-table-grid {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 350px);
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Table Styles */
.activity-table {
    margin-bottom: 0;
    table-layout: fixed;
    min-width: 1200px;
}

.activity-table thead th {
    position: sticky;
    top: 0;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: #555;
    padding: 10px 8px;
    white-space: nowrap;
    z-index: 10;
}

.activity-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.activity-table tbody tr:hover {
    background-color: #f0f7ff !important;
}

.activity-table tbody td {
    padding: 6px 8px;
    vertical-align: middle;
    font-size: 13px;
    border-right: 1px solid #eee;
}

.activity-table tbody td:last-child {
    border-right: none;
}

/* Column Widths */
.col-select {
    width: 35px;
    text-align: center;
}

.col-name {
    width: 280px;
    min-width: 200px;
}

.col-parent {
    width: 180px;
}

.col-chapter {
    width: 80px;
}

.col-external-id {
    width: 120px;
}

.col-dim01,
.col-dim02 {
    width: 100px;
}

.col-date {
    width: 100px;
}

.col-hours {
    width: 80px;
    text-align: right;
}

.col-active {
    width: 60px;
    text-align: center;
}

/* Frozen Column (Name) */
.frozen-col {
    position: sticky;
    left: 35px;
    background: inherit;
    z-index: 5;
}

.activity-table thead .frozen-col {
    z-index: 15;
}

/* Row States */
.activity-table tbody tr.is-folder {
    background-color: #fafafa;
}

.activity-table tbody tr.is-folder td {
    font-weight: 500;
}

.activity-table tbody tr.is-selected {
    background-color: #d9edf7 !important;
}

.activity-table tbody tr.is-dirty {
    background-color: #fcf8e3 !important;
}

.activity-table tbody tr.is-new {
    background-color: #dff0d8 !important;
}

.activity-table tbody tr.is-inactive {
    opacity: 0.6;
}

.activity-table tbody tr.is-inactive td {
    color: #999;
}

/* Cell Content */
.cell-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Editable Cells */
.editable-cell {
    cursor: text;
}

.editable-cell:hover {
    background-color: #fff8e1;
}

.editable-cell.editing {
    padding: 2px;
}

.editable-cell.editing .cell-content {
    display: none;
}

.editable-cell input,
.editable-cell select {
    width: 100%;
    border: 2px solid #337ab7;
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 13px;
    outline: none;
}

.editable-cell input:focus,
.editable-cell select:focus {
    box-shadow: 0 0 0 2px rgba(51, 122, 183, 0.25);
}

/* Folder Toggle */
.folder-toggle {
    display: inline-block;
    width: 18px;
    text-align: center;
    cursor: pointer;
    color: #666;
    margin-right: 3px;
}

.folder-toggle:hover {
    color: #333;
}

.folder-toggle-placeholder {
    display: inline-block;
    width: 18px;
    margin-right: 3px;
}

/* Row Icon */
.row-icon {
    margin-right: 6px;
    color: #888;
}

.is-folder .row-icon {
    color: #f0ad4e;
}

/* Child Count Badge */
.child-count-badge {
    font-size: 11px;
    color: #888;
    margin-left: 2px;
    margin-right: 4px;
}

/* Description Text */
.description-text {
    display: inline;
}

/* Inherited Values */
.inherited {
    color: #888;
    font-style: italic;
}

.inherited-icon {
    font-size: 10px;
    color: #5bc0de;
    margin-left: 4px;
    vertical-align: super;
}

/* Empty State */
.empty-state {
    padding: 60px 20px;
    color: #999;
}

.empty-state i {
    margin-bottom: 15px;
}

.empty-state h4 {
    color: #666;
    margin-bottom: 10px;
}

/* Status Bar */
.activity-table-status {
    padding: 8px 12px;
    background: #f8f8f8;
    border-top: 1px solid #ddd;
    font-size: 12px;
}

/* Alert Overrides */
.activity-table-container .alert {
    margin-bottom: 15px;
}

/* Typeahead Dropdown */
.parent-typeahead + .typeahead.dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

/* Datepicker Positioning */
.datepicker-edit + .datepicker {
    z-index: 1100;
}

/* Print Styles */
@media print {
    .activity-table-toolbar,
    .activity-table-status {
        display: none !important;
    }
    
    .activity-table-grid {
        max-height: none;
        overflow: visible;
        border: none;
    }
    
    .activity-table {
        font-size: 10px;
    }
    
    .activity-table thead th,
    .activity-table tbody td {
        padding: 4px 6px;
    }
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .activity-table-toolbar .btn span {
        display: none;
    }
    
    .activity-table-toolbar .btn i {
        margin-right: 0;
    }
    
    .activity-table {
        min-width: 900px;
    }
    
    .col-parent,
    .col-dim02 {
        display: none;
    }
}

/* Keyboard Focus Indicators */
.activity-table tbody tr:focus,
.activity-table tbody td:focus {
    outline: 2px solid #337ab7;
    outline-offset: -2px;
}

/* Checkbox Styling */
.activity-table input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* Active/Inactive Icons */
.text-success {
    color: #5cb85c;
}

.text-muted {
    color: #999;
}

/* Scrollbar Styling */
.activity-table-grid::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.activity-table-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.activity-table-grid::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

.activity-table-grid::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Required Field Styling */
.required-field {
    background-color: #fff8e1 !important;
}

.required-field::after {
    content: '*';
    color: #d9534f;
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
}

/* Dropdown in cell */
.activity-table .cell-select {
    width: 100%;
    padding: 2px 4px;
    border: 1px solid #66afe9;
    border-radius: 2px;
    font-size: 12px;
    background-color: #fff;
}

.activity-table .cell-select:focus {
    outline: none;
    border-color: #337ab7;
    box-shadow: 0 0 3px rgba(66, 139, 202, 0.3);
}

/* Additional column widths */
.col-external-proj {
    min-width: 120px;
    width: 120px;
}

.col-external-sub-proj {
    min-width: 120px;
    width: 120px;
}

