/* ==================== VARIABLES GLOBALES ==================== */
:root {
    --main-color: #071F32;
    --main-info-color: #354BCF;
    --main-danger-color: #E22C3F;
    --main-success-color: #248619;
    --dark-color: #1A1A1A;
    --dark-light-color: #767676;
    --gray-color: #C3C3C3;
    --gray-light-color: #D9D9D9;
    --gray-lighter-color: #E6E8EA;
    --white-strong-color: #F2F2F2;
    --white-color: #FFF;
    --border-color: #CCC;
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--white-strong-color);
    color: var(--main-color);
    line-height: 1.6;
}

/* ==================== HEADER ==================== */
.main-header {
    background-color: var(--white-color);
    border-bottom: 1px solid var(--gray-light-color);
    padding: 1rem 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.logo-paris {
    height: 45px;
    width: auto;
}

.main-service-title {
    color: var(--main-color);
    font-size: 1.5rem;
    font-weight: 600;
    border-left: 2px solid var(--gray-color);
    padding-left: 1rem;
}

/* ==================== CONTAINER ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ==================== MESSAGES ==================== */
.loading, .error {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.loading {
    color: var(--main-info-color);
}

.error {
    color: var(--main-danger-color);
    border-left: 4px solid var(--main-danger-color);
}

/* ==================== BUTTONS ==================== */
.btn {
    background-color: var(--main-danger-color);
    border: none;
    border-radius: 4px;
    padding: 0.75rem 2rem;
    color: var(--white-color);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: #C6212F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(226, 44, 63, 0.3);
}

.btn-secondary {
    background-color: var(--white-color);
    border: 2px solid var(--gray-color);
    color: var(--main-color);
}

.btn-secondary:hover {
    background-color: var(--gray-lighter-color);
    border-color: var(--main-color);
}

/* ==================== DESCRIPTION PANEL ==================== */
.description-panel {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.description-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-light-color);
}

.description-header h3 {
    color: var(--main-color);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.btn-edit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--white-color);
    border: 2px solid var(--main-info-color);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    color: var(--main-info-color);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit:hover {
    background-color: var(--main-info-color);
    color: var(--white-color);
}

.btn-edit svg {
    width: 16px;
    height: 16px;
}

.description-text {
    color: var(--main-color);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.description-text.empty {
    color: var(--dark-light-color);
    font-style: italic;
}

.description-edit {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.description-textarea {
    width: 100%;
    background-color: var(--white-color);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    color: var(--main-color);
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
}

.description-textarea:focus {
    outline: none;
    border-color: var(--main-info-color);
    box-shadow: 0 0 0 3px rgba(53, 75, 207, 0.1);
}

.description-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ==================== MAIN LAYOUT ==================== */
.main-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* ==================== TREE PANEL ==================== */
.tree-panel {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.tree-panel::-webkit-scrollbar {
    width: 8px;
}

.tree-panel::-webkit-scrollbar-track {
    background: var(--gray-lighter-color);
    border-radius: 4px;
}

.tree-panel::-webkit-scrollbar-thumb {
    background: var(--main-info-color);
    border-radius: 4px;
}

.tree-node {
    user-select: none;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-width: 0;
}

.tree-item:hover {
    background-color: var(--gray-lighter-color);
}

.tree-item.active {
    background-color: rgba(53, 75, 207, 0.1);
    border-left: 3px solid var(--main-info-color);
}

.tree-item-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.expand-icon {
    font-size: 0.7rem;
    color: var(--dark-light-color);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

.icon {
    flex-shrink: 0;
}

.folder-icon {
    color: var(--main-info-color);
}

.folder-icon svg, .document-icon svg {
    display: block;
}

.document-icon {
    color: var(--dark-light-color);
}

.tree-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    min-width: 0;
}

.children {
    display: none;
    margin-left: 1.5rem;
}

.children.expanded {
    display: block;
}

/* ==================== LIBRARY PANEL ==================== */
.library-panel {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 70vh;
    overflow-y: auto;
}

.library-panel::-webkit-scrollbar {
    width: 8px;
}

.library-panel::-webkit-scrollbar-track {
    background: var(--gray-lighter-color);
    border-radius: 4px;
}

.library-panel::-webkit-scrollbar-thumb {
    background: var(--main-info-color);
    border-radius: 4px;
}

/* ==================== BREADCRUMB ==================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--gray-lighter-color);
    border-radius: 4px;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--main-info-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.breadcrumb-item:hover {
    text-decoration: underline;
    color: var(--main-color);
}

.breadcrumb-item.current {
    color: var(--main-color);
    cursor: default;
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--dark-light-color);
}

/* ==================== LIBRARY GRID ==================== */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.library-item {
    background-color: var(--white-color);
    border: 1px solid var(--gray-light-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.library-item:hover {
    border-color: var(--main-info-color);
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(53, 75, 207, 0.2);
}

.library-item-thumbnail {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    background-color: var(--gray-lighter-color);
    border-radius: 4px;
    overflow: hidden;
}

.library-item-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.library-item-name {
    font-size: 0.85rem;
    color: var(--main-color);
    word-break: break-word;
    line-height: 1.4;
    font-weight: 500;
}

.library-item.folder .library-item-name {
    font-weight: 600;
}

.library-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: center;
}

.action-link {
    width: 40px;
    height: 40px;
    padding: 0;
    background-color: var(--main-danger-color);
    border: none;
    border-radius: 6px;
    color: var(--white-color);
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-link:hover {
    background-color: #C6212F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(226, 44, 63, 0.3);
}

.action-link-alfresco {
    background-color: var(--main-info-color);
}

.action-link-alfresco:hover {
    background-color: var(--main-color);
    box-shadow: 0 4px 12px rgba(53, 75, 207, 0.3);
}

.action-link svg {
    width: 20px;
    height: 20px;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--dark-light-color);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* ==================== STATS ==================== */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.stat {
    background-color: var(--white-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--main-info-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--dark-light-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ==================== FOOTER ==================== */
footer {
    background-color: var(--main-color);
    color: var(--white-color);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: var(--white-color);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.footer-links a:hover {
    opacity: 0.8;
}

/* ==================== PDF MODAL ==================== */
.pdf-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(7, 31, 50, 0.95);
}

.pdf-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-modal-content {
    background-color: var(--white-color);
    width: 90%;
    height: 90%;
    max-width: 1200px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.pdf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--gray-light-color);
    background-color: var(--white-color);
    border-radius: 8px 8px 0 0;
}

.pdf-modal-title {
    color: var(--main-color);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 2rem;
}

.pdf-modal-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-open-alfresco, .btn-download {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-open-alfresco {
    background-color: var(--main-info-color);
    color: var(--white-color);
}

.btn-open-alfresco:hover {
    background-color: var(--main-color);
}

.btn-download {
    background-color: var(--main-danger-color);
    color: var(--white-color);
}

.btn-download:hover {
    background-color: #C6212F;
}

.btn-close {
    background-color: transparent;
    border: none;
    color: var(--main-color);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background-color: var(--gray-lighter-color);
}

.pdf-modal-body {
    flex: 1;
    overflow: auto;
    position: relative;
    background-color: var(--gray-lighter-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
}

.pdf-viewer-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
}

#pdfCanvas {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    background-color: var(--white-color);
}

.pdf-loading, .pdf-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.pdf-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--gray-light-color);
    border-top: 4px solid var(--main-info-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pdf-error {
    color: var(--main-danger-color);
}

.pdf-error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.pdf-controls {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--white-color);
    padding: 1rem 2rem;
    border-top: 2px solid var(--gray-light-color);
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.pdf-controls button {
    background-color: var(--main-info-color);
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    color: var(--white-color);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pdf-controls button:hover:not(:disabled) {
    background-color: var(--main-color);
}

.pdf-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdf-page-info {
    color: var(--main-color);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 1rem;
}

.pdf-zoom-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding-left: 1rem;
    border-left: 2px solid var(--gray-light-color);
}

.zoom-button {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.zoom-info {
    color: var(--main-color);
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 60px;
    text-align: center;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .header-container {
        flex-direction: column;
        gap: 1rem;
    }

    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}