/**
 * Team Sync Frontend Styles
 */

/* ==========================================================================
   Badges
   ========================================================================== */

.cxd-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25em 0.75em;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 9999px;
    white-space: nowrap;
}

/* Status badges */
.cxd-badge-status[data-status="not-started"] {
    background: var(--cxd-status-not-started-bg);
    color: var(--cxd-status-not-started-text);
    border: 1px solid var(--cxd-status-not-started-border);
}

.cxd-badge-status[data-status="in-progress"] {
    background: var(--cxd-status-in-progress-bg);
    color: var(--cxd-status-in-progress-text);
    border: 1px solid var(--cxd-status-in-progress-border);
}

.cxd-badge-status[data-status="stalled"] {
    background: var(--cxd-status-stalled-bg);
    color: var(--cxd-status-stalled-text);
    border: 1px solid var(--cxd-status-stalled-border);
}

.cxd-badge-status[data-status="on-hold"] {
    background: var(--cxd-status-on-hold-bg);
    color: var(--cxd-status-on-hold-text);
    border: 1px solid var(--cxd-status-on-hold-border);
}

.cxd-badge-status[data-status="completed"] {
    background: var(--cxd-status-completed-bg);
    color: var(--cxd-status-completed-text);
    border: 1px solid var(--cxd-status-completed-border);
}

.cxd-badge-status[data-status="cancelled"] {
    background: var(--cxd-status-cancelled-bg);
    color: var(--cxd-status-cancelled-text);
    border: 1px solid var(--cxd-status-cancelled-border);
}

.cxd-badge-status[data-status="abandoned"] {
    background: var(--cxd-status-abandoned-bg);
    color: var(--cxd-status-abandoned-text);
    border: 1px solid var(--cxd-status-abandoned-border);
}

.cxd-badge-status[data-status="planning"] {
    background: var(--cxd-status-planning-bg);
    color: var(--cxd-status-planning-text);
    border: 1px solid var(--cxd-status-planning-border);
}

.cxd-badge-status[data-status="planned"] {
    background: var(--cxd-status-planned-bg);
    color: var(--cxd-status-planned-text);
    border: 1px solid var(--cxd-status-planned-border);
}

/* Priority badges */
.cxd-badge-priority[data-priority="low"] {
    background: var(--cxd-priority-low-bg);
    color: var(--cxd-priority-low-text);
    border: 1px solid var(--cxd-priority-low-border);
}

.cxd-badge-priority[data-priority="medium"] {
    background: var(--cxd-priority-medium-bg);
    color: var(--cxd-priority-medium-text);
    border: 1px solid var(--cxd-priority-medium-border);
}

.cxd-badge-priority[data-priority="high"] {
    background: var(--cxd-priority-high-bg);
    color: var(--cxd-priority-high-text);
    border: 1px solid var(--cxd-priority-high-border);
}

.cxd-badge-priority[data-priority="critical"] {
    background: var(--cxd-priority-critical-bg);
    color: var(--cxd-priority-critical-text);
    border: 1px solid var(--cxd-priority-critical-border);
}

/* Achievement tier badges */
.cxd-badge-tier[data-tier="bronze"] {
    background: var(--cxd-tier-bronze-bg);
    color: var(--cxd-tier-bronze-text);
    border: 1px solid var(--cxd-tier-bronze-border);
}

.cxd-badge-tier[data-tier="silver"] {
    background: var(--cxd-tier-silver-bg);
    color: var(--cxd-tier-silver-text);
    border: 1px solid var(--cxd-tier-silver-border);
}

.cxd-badge-tier[data-tier="gold"] {
    background: var(--cxd-tier-gold-bg);
    color: var(--cxd-tier-gold-text);
    border: 1px solid var(--cxd-tier-gold-border);
}

.cxd-badge-tier[data-tier="platinum"] {
    background: var(--cxd-tier-platinum-bg);
    color: var(--cxd-tier-platinum-text);
    border: 1px solid var(--cxd-tier-platinum-border);
}

/* Tracking badges */
.cxd-badge-tracking[data-tracking="on-track"] {
    background: var(--cxd-tracking-on-track-bg);
    color: var(--cxd-tracking-on-track-text);
    border: 1px solid var(--cxd-tracking-on-track-border);
}

.cxd-badge-tracking[data-tracking="approaching"] {
    background: var(--cxd-tracking-approaching-bg);
    color: var(--cxd-tracking-approaching-text);
    border: 1px solid var(--cxd-tracking-approaching-border);
}

.cxd-badge-tracking[data-tracking="overdue"] {
    background: var(--cxd-tracking-overdue-bg);
    color: var(--cxd-tracking-overdue-text);
    border: 1px solid var(--cxd-tracking-overdue-border);
}

/* Meeting type badges */
.cxd-badge-meeting-type[data-type="weekly-1on1"] {
    background: var(--cxd-meeting-weekly-1on1-bg);
    color: var(--cxd-meeting-weekly-1on1-text);
    border: 1px solid var(--cxd-meeting-weekly-1on1-border);
}

.cxd-badge-meeting-type[data-type="team-meeting"] {
    background: var(--cxd-meeting-team-meeting-bg);
    color: var(--cxd-meeting-team-meeting-text);
    border: 1px solid var(--cxd-meeting-team-meeting-border);
}

.cxd-badge-meeting-type[data-type="project-sync"] {
    background: var(--cxd-meeting-project-sync-bg);
    color: var(--cxd-meeting-project-sync-text);
    border: 1px solid var(--cxd-meeting-project-sync-border);
}

.cxd-badge-meeting-type[data-type="ad-hoc"] {
    background: var(--cxd-meeting-ad-hoc-bg);
    color: var(--cxd-meeting-ad-hoc-text);
    border: 1px solid var(--cxd-meeting-ad-hoc-border);
}

/* ==========================================================================
   Entry Types (for Breakdance data-attribute styling)
   ========================================================================== */

.cxd-entry[data-entry-type="Update"] {
    border-left: 3px solid var(--cxd-entry-update-border);
}
.cxd-entry[data-entry-type="Update"] .cxd-entry-label {
    color: var(--cxd-entry-update-text);
}

.cxd-entry[data-entry-type="Note"] {
    border-left: 3px solid var(--cxd-entry-note-border);
}
.cxd-entry[data-entry-type="Note"] .cxd-entry-label {
    color: var(--cxd-entry-note-text);
}

.cxd-entry[data-entry-type="Blocker"] {
    border-left: 3px solid var(--cxd-entry-blocker-border);
}
.cxd-entry[data-entry-type="Blocker"] .cxd-entry-label {
    color: var(--cxd-entry-blocker-text);
}

.cxd-entry[data-entry-type="Achievement"] {
    border-left: 3px solid var(--cxd-entry-achievement-border);
}
.cxd-entry[data-entry-type="Achievement"] .cxd-entry-label {
    color: var(--cxd-entry-achievement-text);
}

.cxd-entry[data-entry-type="Deliverable"] {
    border-left: 3px solid var(--cxd-entry-deliverable-border);
}
.cxd-entry[data-entry-type="Deliverable"] .cxd-entry-label {
    color: var(--cxd-entry-deliverable-text);
}

/* ==========================================================================
   Serial & Author
   ========================================================================== */

.cxd-serial {
    font-family: ui-monospace, monospace;
    font-size: 0.875rem;
    color: #6b7280;
}

.cxd-author-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    font-size: 0.875rem;
    color: #4b5563;
}

.cxd-author-badge .dashicons {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.cxd-progress-bar {
    position: relative;
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.cxd-progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.cxd-progress-blue .cxd-progress-fill {
    background: #3b82f6;
}

.cxd-progress-green .cxd-progress-fill {
    background: #22c55e;
}

.cxd-progress-yellow .cxd-progress-fill {
    background: #eab308;
}

.cxd-progress-text {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    padding-left: 0.5rem;
}

/* ==========================================================================
   Counts
   ========================================================================== */

.cxd-count {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ==========================================================================
   Banners
   ========================================================================== */

.cxd-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid;
}

.cxd-banner-icon {
    flex-shrink: 0;
}

.cxd-banner-text {
    font-size: 0.875rem;
}

.cxd-banner-text a {
    font-weight: 600;
    text-decoration: underline;
}

.cxd-banner-info {
    background: var(--cxd-banner-info-bg);
    color: var(--cxd-banner-info-text);
    border-color: var(--cxd-banner-info-border);
}

.cxd-banner-success {
    background: var(--cxd-banner-success-bg);
    color: var(--cxd-banner-success-text);
    border-color: var(--cxd-banner-success-border);
}

.cxd-banner-warning {
    background: var(--cxd-banner-warning-bg);
    color: var(--cxd-banner-warning-text);
    border-color: var(--cxd-banner-warning-border);
}

.cxd-banner-error {
    background: var(--cxd-banner-error-bg);
    color: var(--cxd-banner-error-text);
    border-color: var(--cxd-banner-error-border);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.cxd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.cxd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cxd-btn-primary {
    background: #3b82f6;
    color: white;
}

.cxd-btn-primary:hover {
    background: #2563eb;
}

.cxd-btn-secondary {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}

.cxd-btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.cxd-btn-danger {
    background: #ef4444;
    color: white;
}

.cxd-btn-danger:hover {
    background: #dc2626;
}

/* ==========================================================================
   Action Buttons & Dropdown
   ========================================================================== */

.cxd-action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.cxd-dropdown {
    position: relative;
}

.cxd-dropdown-toggle .dashicons {
    font-size: 0.875rem;
    width: 0.875rem;
    height: 0.875rem;
}

.cxd-dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    min-width: 12rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    display: none;
}

.cxd-dropdown.open .cxd-dropdown-menu {
    display: block;
}

.cxd-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    color: #374151;
    background: none;
    border: none;
    cursor: pointer;
}

.cxd-dropdown-item:hover {
    background: #f3f4f6;
}

.cxd-dropdown-item:first-child {
    border-radius: 0.5rem 0.5rem 0 0;
}

.cxd-dropdown-item:last-child {
    border-radius: 0 0 0.5rem 0.5rem;
}

/* ==========================================================================
   Status Select
   ========================================================================== */

.cxd-status-select {
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.cxd-status-select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ==========================================================================
   Modals
   ========================================================================== */

.cxd-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cxd-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.cxd-modal-content {
    position: relative;
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.cxd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.cxd-modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.cxd-modal-close {
    padding: 0.25rem;
    font-size: 1.5rem;
    line-height: 1;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
}

.cxd-modal-close:hover {
    color: #1f2937;
}

.cxd-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
}

.cxd-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.cxd-form-group {
    margin-bottom: 1rem;
}

.cxd-form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.cxd-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

.cxd-input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

textarea.cxd-input {
    resize: vertical;
    min-height: 5rem;
}

.cxd-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.cxd-radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-weight: normal;
    cursor: pointer;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.cxd-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: #1f2937;
    color: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    animation: cxd-toast-in 0.3s ease;
}

@keyframes cxd-toast-in {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cxd-toast.cxd-toast-success {
    background: #22c55e;
}

.cxd-toast.cxd-toast-error {
    background: #ef4444;
}

/* ==========================================================================
   AJAX Checkbox
   ========================================================================== */

.cxd-ajax-checkbox {
    cursor: pointer;
    width: 1.25rem;
    height: 1.25rem;
}

.cxd-ajax-checkbox.saving {
    opacity: 0.5;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.cxd-loading {
    position: relative;
    pointer-events: none;
}

.cxd-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Editable Textarea
   ========================================================================== */

.cxd-editable-textarea {
    position: relative;
}

.cxd-display-mode {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.cxd-display-text {
    flex: 1;
    padding: 0.5rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    min-height: 2.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.cxd-display-text .cxd-placeholder {
    color: #9ca3af;
    font-style: italic;
}

.cxd-edit-btn {
    flex-shrink: 0;
    padding: 0.375rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cxd-edit-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

.cxd-edit-btn .dashicons {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
}

.cxd-edit-mode {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cxd-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border: 1px solid #3b82f6;
    border-radius: 0.375rem;
    resize: vertical;
    min-height: 5rem;
}

.cxd-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.cxd-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.cxd-btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}
