/* Project Modal Styles */

.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 900px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

/* Modal Header */
.modal-header {
    padding: 10px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

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

/* Modal Toolbar */
.modal-toolbar {
    padding: 5px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.search-container {
    flex: 1;
    max-width: 350px;
}

.search-container.input-append {
    display: inline-flex;
    align-items: center;
}

.search-container .project-search {
    border-radius: 3px 0 0 3px;
}

.search-container .add-on {
    border-radius: 0 3px 3px 0;
}

.toolbar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Dropdown styling */
.toolbar-controls .btn-group:first-child .dropdown-toggle {
    min-width: 180px;
    text-align: left;
    position: relative;
}

.toolbar-controls .btn-group:nth-child(2) .dropdown-toggle {
    min-width: 110px;
    text-align: left;
    position: relative;
}

.toolbar-controls .btn-group .dropdown-toggle .caret {
    position: absolute;
    right: 10px;
    top: 50%;
    margin-top: -2px;
}

/* Let Bootstrap handle the button group styling */
.view-toggle.btn-group {
    margin-left: 5px;
}

.view-toggle .btn {
    padding: 4px 12px;
}

/* Modal Body */
.modal-body {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background: #fafafa;
    max-height: max-content;
}

/* Loading State */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Grid View */
.projects-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.project-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.project-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    border-color: #0088cc;
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.project-name {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    padding-right: 10px;
}

.project-actions {
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.project-card:hover .project-actions {
    opacity: 1;
}

.btn-icon {
    background: none;
    border: 1px solid transparent;
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 3px;
    color: #666;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-icon:hover {
    background: #f5f5f5;
    border-color: #ddd;
}

.btn-icon.btn-delete:hover {
    background: #ffebee;
    color: #f44336;
    border-color: #ffcdd2;
}

.project-card-body {
    margin-bottom: 10px;
}

.project-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #666;
}

.project-metadata span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-metadata i {
    font-size: 12px;
}

.project-card-footer {
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.project-date {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #999;
}

/* List View */
.projects-container.list-view {
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
}

.projects-table thead {
    background: #f5f5f5;
}

.projects-table th {
    text-align: left;
    padding: 12px 15px;
    font-weight: 500;
    color: #666;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.projects-table td {
    padding: 12px 15px;
    border-top: 1px solid #f0f0f0;
    font-size: 14px;
}

.project-row {
    cursor: pointer;
    transition: background 0.2s;
}

.project-row:hover {
    background: #e8f4fd;
}

.project-row .project-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.project-row:hover .project-actions {
    opacity: 1;
}

/* No Projects State */
.no-projects {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    text-align: center;
}

.no-projects p {
    margin: 10px 0;
}

.no-projects .text-muted {
    font-size: 14px;
    color: #bbb;
}

/* Error State */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #f44336;
    text-align: center;
}

.error-message i {
    font-size: 48px;
    margin-bottom: 15px;
}

/* Modal Footer */
.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-left {
    color: #666;
    font-size: 14px;
    min-width: 150px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
}

.pagination-info {
    color: #666;
    font-size: 14px;
    min-width: 100px;
    text-align: center;
}

.pagination-controls .btn {
    padding: 4px 10px;
    font-size: 13px;
}

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

/* Let Bootstrap handle button styling in the footer */
.modal-footer .btn {
    margin-left: 5px;
}

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

@keyframes slideUp {
    from {
        transform: translate(-50%, -45%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        height: 90vh;
        max-height: none;
    }

    .modal-toolbar {
        flex-direction: column;
        gap: 10px;
    }

    .search-container {
        max-width: 100%;
    }

    .toolbar-controls {
        width: 100%;
        flex-wrap: wrap;
        gap: 5px;
    }

    .toolbar-controls .btn-group {
        flex: 1 1 calc(50% - 5px);
        min-width: 120px;
    }

    .toolbar-controls .view-toggle {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .projects-container.grid-view {
        grid-template-columns: 1fr;
    }

    .projects-table {
        font-size: 12px;
    }

    .projects-table th,
    .projects-table td {
        padding: 8px 10px;
    }

    /* Hide some columns on mobile */
    .projects-table th:nth-child(3),
    .projects-table td:nth-child(3) {
        display: none;
    }

    /* Responsive footer layout */
    .modal-footer {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }

    .footer-left,
    .pagination-controls {
        width: 100%;
        justify-content: center;
    }

    .pagination-controls {
        order: 2;
        margin: 0;
    }

    .footer-left {
        order: 1;
        text-align: center;
        min-width: auto;
    }
}