/* AMD Construction Pro - Components CSS */

/* Form Components */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.form-input:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}

.form-input.error {
    border-color: #dc3545;
}

.form-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}

.form-checkbox {
    margin-right: 8px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-col {
    flex: 1;
}

/* Card Components */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #333;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Table Components */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

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

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

/* List Components */
.list-group {
    border-radius: 4px;
    overflow: hidden;
}

.list-item {
    padding: 12px 16px;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
    transition: background-color 0.2s;
}

.list-item:hover {
    background: #f8f9fa;
}

.list-item.active {
    background: #e3f2fd;
    border-left: 4px solid #1e40af;
}

/* Project status styling - explicitly reset any active styling */
.project-item.status-active {
    background: transparent !important; /* Force reset any inherited background */
    border-left: none !important; /* Force reset any inherited left border */
    color: inherit !important; /* Force reset any inherited text color */
    border-right: 3px solid #22c55e; /* Green for active projects */
}

.project-item.status-completed {
    background: transparent !important;
    border-left: none !important;
    color: inherit !important;
    border-right: 3px solid #6b7280; /* Gray for completed projects */
}

.project-item.status-on-hold {
    background: transparent !important;
    border-left: none !important;
    color: inherit !important;
    border-right: 3px solid #f59e0b; /* Orange for on-hold projects */
}

.project-item.status-planning {
    background: transparent !important;
    border-left: none !important;
    color: inherit !important;
    border-right: 3px solid #8b5cf6; /* Purple for planning projects */
}

.project-item.status-cancelled {
    background: transparent !important;
    border-left: none !important;
    color: inherit !important;
    border-right: 3px solid #ef4444; /* Red for cancelled projects */
}

/* Project item selected state - overrides status styling */
.project-item.selected {
    background: #f0f9ff !important;
    border-left: 4px solid #0ea5e9 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Project item hover effect */
.project-item:hover:not(.selected) {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.list-item-subtitle {
    font-size: 12px;
    color: #6c757d;
}

/* Badge Components */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.primary {
    background: #e3f2fd;
    color: #1e40af;
}

.badge.success {
    background: #d4edda;
    color: #155724;
}

.badge.warning {
    background: #fff3cd;
    color: #856404;
}

.badge.danger {
    background: #f8d7da;
    color: #721c24;
}

.badge.secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* Progress Components */
.progress {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #1e40af;
    transition: width 0.3s ease;
}

.progress-bar.success {
    background: #28a745;
}

.progress-bar.warning {
    background: #ffc107;
}

.progress-bar.danger {
    background: #dc3545;
}

/* Modal Components */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Tooltip Components */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Alert Components */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.alert.danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert.info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Loading Components */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1e40af;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* Dropdown Components */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background: white;
    border: 1px solid #ced4da;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-divider {
    height: 1px;
    background: #dee2e6;
    margin: 4px 0;
}

/* Tab Components */
.tabs {
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 20px;
}

.tab-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    background: #f8f9fa;
}

.tab.active {
    border-bottom-color: #1e40af;
    color: #1e40af;
    font-weight: 600;
}

/* Modified TAB CONTENT - More flexible selectors */
.tab-content {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

/* For backward compatibility */
.app-container .main-content .tab-content {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

.app-container .main-content .tab-content.active {
    display: block;
}

/* Accordion Components */
.accordion-item {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: background-color 0.2s;
}

.accordion-header:hover {
    background: #e9ecef;
}

.accordion-content {
    padding: 20px;
    display: none;
}

.accordion-item.open .accordion-content {
    display: block;
}

/* Pagination Components */
.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.page-btn:hover {
    background: #f8f9fa;
}

.page-btn.active {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Search Components */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 20px;
    font-size: 14px;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.search-clear {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    display: none;
}

.search-container.has-value .search-clear {
    display: block;
}

/* File Upload Components */
.file-upload {
    position: relative;
    display: inline-block;
}

.file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-label {
    display: block;
    padding: 10px 20px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-label:hover {
    background: #e9ecef;
    border-color: #1e40af;
}

.file-label.drag-over {
    background: #e3f2fd;
    border-color: #1e40af;
}

/* Tree View Components */
.tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-item {
    position: relative;
}

.tree-content {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.tree-content:hover {
    background: #f8f9fa;
}

.tree-content.selected {
    background: #e3f2fd;
    color: #1e40af;
}

.tree-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-children {
    margin-left: 20px;
    display: none;
}

.tree-item.open > .tree-children {
    display: block;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: #1e40af; }
.text-success { color: #28a745; }
.text-warning { color: #ffc107; }
.text-danger { color: #dc3545; }
.text-muted { color: #6c757d; }

.bg-primary { background-color: #1e40af; }
.bg-success { background-color: #28a745; }
.bg-warning { background-color: #ffc107; }
.bg-danger { background-color: #dc3545; }
.bg-light { background-color: #f8f9fa; }

.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 1rem; }
.m-4 { margin: 1.5rem; }
.m-5 { margin: 3rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-1 { flex: 1; }
.flex-grow-1 { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
.shadow-lg { box-shadow: 0 10px 25px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }

/* Utility Classes for Inline Style Replacement */
.flex-center {
    display: flex;
    align-items: center;
    gap: 5px;
}

.calendar-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.filter-label {
    font-size: 12px;
    font-weight: 500;
}

.filter-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.hidden {
    display: none;
}

.task-bar {
    position: absolute;
    height: 100%;
    border-radius: 2px;
    color: white;
    font-size: 11px;
    display: flex;
    align-items: center;
    padding-left: 5px;
}

.task-bar-foundation {
    left: 0%;
    width: 25%;
    background: #4caf50;
}

.task-bar-framing {
    left: 25%;
    width: 30%;
    background: #2196f3;
}

.task-bar-electrical {
    left: 55%;
    width: 20%;
    background: #ff9800;
}

.task-bar-plumbing {
    left: 55%;
    width: 20%;
    background: #9c27b0;
}

.task-bar-finishing {
    left: 75%;
    width: 25%;
    background: #607d8b;
}

.empty-state {
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Tab-specific ID prefixes to avoid conflicts will be handled by unique IDs per tab */

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
