/* SharePoint 365 Integration - Frontend Styles */

.sp365-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* Header */
.sp365-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0078d4;
    color: #fff;
    padding: 12px 16px;
}
.sp365-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex: 1;
}
.sp365-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: .9;
}

/* Refresh button */
.sp365-refresh {
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    transition: background .2s;
}
.sp365-refresh:hover { background: rgba(255,255,255,.35); }
.sp365-refresh svg { width: 16px; height: 16px; }
.sp365-refresh.loading svg { animation: sp365-spin 1s linear infinite; }

@keyframes sp365-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Body */
.sp365-body { padding: 0; }

/* Search */
.sp365-search-bar {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}
.sp365-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
    transition: border-color .2s;
}
.sp365-search:focus { border-color: #0078d4; }

/* Table */
.sp365-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.sp365-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.sp365-table thead th {
    background: #f4f4f4;
    border-bottom: 2px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}
.sp365-table tbody tr:nth-child(even) { background: #fafbfc; }
.sp365-table tbody tr:hover { background: #e8f0fe; }
.sp365-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
    vertical-align: middle;
}
.sp365-table .sp365-date { color: #888; white-space: nowrap; }
.sp365-table tr.sp365-hidden { display: none; }

/* Document list */
.sp365-doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sp365-doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: background .15s;
}
.sp365-doc-item:last-child { border-bottom: none; }
.sp365-doc-item:hover { background: #e8f0fe; }
.sp365-doc-item.sp365-hidden { display: none; }

.sp365-doc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #0078d4;
    font-weight: 500;
    flex: 1;
    min-width: 0;
}
.sp365-doc-link:hover { text-decoration: underline; }
.sp365-doc-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp365-file-icon { font-size: 18px; flex-shrink: 0; }

.sp365-doc-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: #888;
    flex-shrink: 0;
    margin-left: 12px;
    white-space: nowrap;
}

/* Footer */
.sp365-footer {
    display: flex;
    justify-content: space-between;
    padding: 7px 14px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    font-size: 11px;
    color: #999;
}

/* Error / empty */
.sp365-error-box,
.sp365-empty {
    padding: 20px;
    text-align: center;
    color: #888;
}
.sp365-error-box { color: #c0392b; }
.sp365-error { color: #c0392b; font-size: 13px; }
