/* ==========================================================================
   Envitech Document Library - Frontend Styles
   ========================================================================== */

.edl-library-wrap {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Toolbar: Search + Filters */
.edl-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.edl-search-wrap {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.edl-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.edl-search-input {
    width: 100%;
    padding: 12px 16px 12px 42px !important;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: #fff;
}

.edl-search-input:focus {
    border-color: #00BCD4;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.15);
}

.edl-filters {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.edl-tag-filter,
.edl-sort-filter {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
    outline: none;
    min-width: 140px;
    appearance: auto;
}

.edl-tag-filter:focus,
.edl-sort-filter:focus {
    border-color: #00BCD4;
}

/* Document Grid */
.edl-grid {
    display: grid;
    grid-template-columns: repeat(var(--edl-columns, 3), 1fr);
    gap: 20px;
}

/* Document Card */
.edl-card {
    background: #fff;
    border: 2px solid #00BCD4;
    border-radius: 10px;
    padding: 24px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
}

.edl-card:hover {
    box-shadow: 0 4px 16px rgba(0, 188, 212, 0.18);
    transform: translateY(-2px);
}

/* Card Icon */
.edl-card-icon {
    margin-bottom: 12px;
}

.edl-card-icon svg {
    display: block;
}

/* Card Title */
.edl-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    width: 100%;
}

/* Card Size */
.edl-card-size {
    font-size: 13px;
    color: #888;
    margin: 0 0 16px;
}

/* Download Button */
.edl-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background: #00BCD4;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: auto;
}

.edl-download-btn:hover {
    background: #00ACC1;
}

.edl-download-btn svg {
    stroke: #fff;
}

/* No Results */
.edl-no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    font-size: 15px;
    padding: 40px 0;
}

/* Loading Spinner */
.edl-loading {
    text-align: center;
    padding: 40px 0;
}

.edl-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #00BCD4;
    border-radius: 50%;
    animation: edl-spin 0.7s linear infinite;
}

@keyframes edl-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.edl-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.edl-modal {
    background: #fff;
    border-radius: 12px;
    padding: 36px 32px;
    max-width: 480px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
}

.edl-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

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

.edl-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px;
}

.edl-modal-desc {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px;
}

/* Form Layout (2-column support) */
.edl-lead-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0 16px;
}

.edl-lead-form .edl-form-doc-id,
.edl-lead-form .edl-custom-field-slot,
.edl-lead-form .edl-form-errors,
.edl-lead-form .edl-form-submit {
    width: 100%;
}

/* Form Groups */
.edl-form-group {
    margin-bottom: 16px;
}

.edl-form-group--full {
    width: 100%;
}

.edl-form-group--half {
    width: calc(50% - 8px);
}

.edl-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.edl-required {
    color: #e53935;
}

.edl-form-group input[type="text"],
.edl-form-group input[type="email"],
.edl-form-group input[type="tel"],
.edl-form-group textarea,
.edl-form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: #fff;
}

.edl-form-group input:focus,
.edl-form-group textarea:focus,
.edl-form-group select:focus {
    border-color: #00BCD4;
    box-shadow: 0 0 0 2px rgba(0, 188, 212, 0.15);
}

.edl-form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.edl-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    font-size: 14px;
    cursor: pointer;
}

/* Form Errors */
.edl-form-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #dc2626;
    font-size: 13px;
}

.edl-form-errors ul {
    margin: 0;
    padding: 0 0 0 18px;
}

/* Submit Button */
.edl-form-submit {
    display: block;
    width: 100%;
    padding: 14px;
    background: #00BCD4;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.edl-form-submit:hover {
    background: #00ACC1;
}

.edl-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

@media (max-width: 900px) {
    .edl-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .edl-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .edl-filters {
        width: 100%;
    }

    .edl-tag-filter,
    .edl-sort-filter {
        flex: 1;
    }
}

@media (max-width: 560px) {
    .edl-grid {
        grid-template-columns: 1fr;
    }

    .edl-filters {
        flex-direction: column;
    }

    .edl-modal {
        padding: 24px 20px;
    }

    .edl-form-group--half {
        width: 100%;
    }
}
