/**
 * MS365 WP Connect – Front-end Styles
 * ────────────────────────────────────
 */

/* ── Base / Reset ──────────────────────────────────────────────────── */
.ms365-notice,
.ms365-error {
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    margin: 12px 0;
}
.ms365-notice {
    background: #f0f4ff;
    border: 1px solid #c5d4f7;
    color: #2c4b8a;
}
.ms365-error {
    background: #fff0f0;
    border: 1px solid #f5c6c6;
    color: #8a2c2c;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.ms365-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
    line-height: 1.4;
}
.ms365-btn-login {
    background: #2f2f2f;
    color: #fff;
}
.ms365-btn-login:hover {
    background: #1a1a1a;
    color: #fff;
}
.ms365-btn-login svg {
    flex-shrink: 0;
}
.ms365-btn-logout {
    background: #e5e7eb;
    color: #333;
    padding: 6px 14px;
    font-size: 13px;
}
.ms365-btn-logout:hover {
    background: #d1d5db;
    color: #333;
}
.ms365-btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    gap: 4px;
}
.ms365-btn-download {
    background: #0078d4;
    color: #fff;
    border-radius: 4px;
}
.ms365-btn-download:hover {
    background: #005fa3;
    color: #fff;
}

/* ── Login Widget ──────────────────────────────────────────────────── */
.ms365-login-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.ms365-greeting {
    font-size: 14px;
    color: #444;
}

/* ── Calendar ──────────────────────────────────────────────────────── */
.ms365-calendar {
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
    background: #fff;
}
.ms365-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #f8f9fb;
    border-bottom: 1px solid #e2e5ea;
}
.ms365-calendar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.ms365-calendar-range {
    font-size: 13px;
    color: #666;
}

/* Day group */
.ms365-day {
    border-bottom: 1px solid #eee;
}
.ms365-day:last-child {
    border-bottom: none;
}
.ms365-day-label {
    padding: 10px 18px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
    background: #fbfbfc;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ms365-day-today .ms365-day-label {
    background: #eef3ff;
    color: #0050a0;
}
.ms365-badge {
    display: inline-block;
    background: #0078d4;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: 0.4px;
}

/* Event row */
.ms365-event {
    display: flex;
    gap: 16px;
    padding: 10px 18px;
    border-top: 1px solid #f0f0f0;
    align-items: flex-start;
}
.ms365-event-time {
    flex: 0 0 110px;
    font-size: 13px;
    color: #666;
    padding-top: 2px;
    white-space: nowrap;
}
.ms365-allday {
    font-weight: 500;
    color: #0078d4;
}
.ms365-sep {
    margin: 0 3px;
    color: #bbb;
}
.ms365-event-details {
    flex: 1;
    min-width: 0;
}
.ms365-event-subject {
    font-weight: 500;
    font-size: 14px;
    color: #222;
    margin-bottom: 3px;
}
.ms365-event-location {
    font-size: 12px;
    color: #777;
    margin-bottom: 4px;
}
.ms365-event-actions {
    display: flex;
    gap: 12px;
}
.ms365-link {
    font-size: 12px;
    color: #0078d4;
    text-decoration: none;
}
.ms365-link:hover {
    text-decoration: underline;
}
.ms365-teams-link {
    font-weight: 500;
}

/* ── Team Calendar extras ──────────────────────────────────────────── */
.ms365-event-organizer {
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}
.ms365-event-preview {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
    font-style: italic;
}

/* ── SharePoint Browser ────────────────────────────────────────────── */
.ms365-sharepoint {
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
    background: #fff;
}

/* Optional title */
.ms365-sp-title {
    padding: 14px 18px 0;
}
.ms365-sp-title h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: #222;
}

/* Toolbar */
.ms365-sp-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #f8f9fb;
    border-bottom: 1px solid #e2e5ea;
    flex-wrap: wrap;
    gap: 8px;
}
.ms365-sp-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 13px;
}
.ms365-sp-crumb {
    color: #0078d4;
    cursor: pointer;
    font-weight: 500;
}
.ms365-sp-crumb:hover {
    text-decoration: underline;
}
.ms365-sp-crumb-sep {
    color: #aaa;
    margin: 0 2px;
    user-select: none;
}
.ms365-sp-crumb:last-child {
    color: #333;
    cursor: default;
    font-weight: 600;
}
.ms365-sp-crumb:last-child:hover {
    text-decoration: none;
}

.ms365-sp-search input {
    padding: 6px 10px;
    border: 1px solid #d0d3d9;
    border-radius: 4px;
    font-size: 13px;
    width: 200px;
}
.ms365-sp-search input:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0,120,212,0.15);
}

/* Table */
.ms365-sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ms365-sp-table thead th {
    text-align: left;
    padding: 8px 16px;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #e2e5ea;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.ms365-sp-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}
.ms365-sp-table tbody tr:hover {
    background: #f5f8ff;
}
.ms365-sp-table td {
    padding: 10px 16px;
    vertical-align: middle;
}
.ms365-sp-col-name {
    min-width: 200px;
}
.ms365-sp-col-date {
    white-space: nowrap;
    color: #777;
}
.ms365-sp-col-size {
    white-space: nowrap;
    color: #777;
    text-align: right;
}
.ms365-sp-col-action {
    text-align: right;
    white-space: nowrap;
}
.ms365-sp-icon {
    margin-right: 4px;
}

/* Folder link */
.ms365-sp-folder-link {
    color: #0078d4;
    text-decoration: none;
    font-weight: 500;
}
.ms365-sp-folder-link:hover {
    text-decoration: underline;
}

/* Empty */
.ms365-sp-empty {
    padding: 32px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* Loading */
.ms365-sp-loading {
    padding: 24px;
    text-align: center;
    color: #666;
    font-size: 13px;
}
.ms365-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #d0d3d9;
    border-top-color: #0078d4;
    border-radius: 50%;
    animation: ms365-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes ms365-spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ms365-event {
        flex-direction: column;
        gap: 4px;
    }
    .ms365-event-time {
        flex: none;
    }
    .ms365-sp-col-date,
    .ms365-sp-col-size {
        display: none;
    }
    .ms365-sp-search input {
        width: 140px;
    }
}
