/**
 * Document Management Styles
 * BEM naming convention: block__element--modifier
 */

/* ============================================
   Document Display (Homepage)
   ============================================ */

/* Documents Section */
.documents-section {
    margin-top: 2rem;
    padding: 2rem 1.25rem;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
}

.documents-section__title {
    font-size: 1.8em;
    margin-bottom: 10px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.documents-section__subtitle {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 30px;
}

/* Documents Grid */
.documents-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    align-items: start;
}

/* Document Card */
.document-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 160px;
}

.document-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #2196F3;
}

.document-card__header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.document-card__icon {
    font-size: 2.5em;
    flex-shrink: 0;
}

.document-card__info {
    flex: 1;
    min-width: 0;
}

.document-card__name {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-card__meta {
    font-size: 0.85em;
    color: #888;
}

.document-card__description {
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 15px;
    /* Limit to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.document-card__footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.btn-download {
    display: inline-block;
    padding: 8px 16px;
    background: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background 0.2s ease;
}

.btn-download:hover {
    background: #1976D2;
}

/* File Type Icons (using Font Awesome) */
.icon-pdf::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f1c1";  /* fa-file-pdf */
}
.icon-word::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f1c2";  /* fa-file-word */
}
.icon-excel::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f1c3";  /* fa-file-excel */
}
.icon-powerpoint::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f1c4";  /* fa-file-powerpoint */
}
.icon-image::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f1c5";  /* fa-file-image */
}
.icon-text::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f15c";  /* fa-file-lines */
}
.icon-link::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f0c1";  /* fa-link */
}
.icon-file::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f15b";  /* fa-file */
}

/* Empty State */
.documents-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.documents-empty__icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.documents-empty__message {
    font-size: 1.1em;
    margin-bottom: 10px;
}

.documents-empty__hint {
    font-size: 0.9em;
    color: #bbb;
}

/* ============================================
   Document Management (Settings Page)
   ============================================ */

/* Documents Management Container */
.documents-management {
    padding: 20px;
}

.documents-management__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.documents-management__title {
    font-size: 1.3em;
    color: #333;
}

/* Upload Button */
.btn-upload {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-upload:hover {
    background: #388E3C;
}

/* Documents Table */
.documents-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.documents-table th {
    background: #f5f5f5;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
    border-bottom: 2px solid #ddd;
}

.documents-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
}

.documents-table tbody tr:hover {
    background: #fafafa;
}

.documents-table__name {
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.documents-table__size {
    color: #888;
}

.documents-table__date {
    color: #888;
    font-size: 0.85em;
}

.documents-table__actions {
    display: flex;
    gap: 8px;
}

/* Table Action Buttons */
.btn-table-action {
    padding: 4px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.btn-edit {
    background: #2196F3;
    color: white;
}

.btn-edit:hover {
    background: #1976D2;
}

.btn-delete {
    background: #f44336;
    color: white;
}

.btn-delete:hover {
    background: #d32f2f;
}

/* Empty Table State */
.documents-table-empty {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Upload/Edit Form */
.document-form {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.document-form--visible {
    display: block;
}

.document-form__title {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #333;
}

.document-form__group {
    margin-bottom: 15px;
}

.document-form__label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
}

.document-form__input,
.document-form__textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: inherit;
}

.document-form__textarea {
    min-height: 80px;
    resize: vertical;
}

.document-form__input:focus,
.document-form__textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.document-form__file-input {
    width: 100%;
}

.document-form__hint {
    font-size: 0.8em;
    color: #888;
    margin-top: 4px;
}

.document-form__actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-submit {
    padding: 8px 16px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-submit:hover {
    background: #388E3C;
}

.btn-cancel {
    padding: 8px 16px;
    background: #9e9e9e;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-cancel:hover {
    background: #757575;
}

/* Loading State */
.document-form__loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #666;
}

.document-form__loading--visible {
    display: block;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
    .documents-grid {
        grid-template-columns: 1fr;
    }

    .documents-table {
        font-size: 0.85em;
    }

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

    /* Hide less important columns on mobile */
    .documents-table__size-col {
        display: none;
    }

    .documents-management__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .btn-upload {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .document-card {
        padding: 15px;
    }

    .document-card__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .documents-table__actions {
        flex-direction: column;
        gap: 4px;
    }

    .btn-table-action {
        width: 100%;
    }
}

/* Desktop (3 columns) */
@media (min-width: 1201px) {
    .documents-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet (2 columns) */
@media (min-width: 769px) and (max-width: 1200px) {
    .documents-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
