/**
 * P7 Team Manager - Styles
 */

/* ===== BASE ===== */
.p7tm {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    color: #2C2C2C;
    max-width: 1200px;
    margin: 0 auto;
}

.p7tm * {
    box-sizing: border-box;
}

/* ===== HEADER ===== */
.p7tm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.p7tm-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2C2C2C;
    margin: 0;
}

/* ===== TABS ===== */
.p7tm-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #E8E5E0;
    padding-bottom: 0;
}

.p7tm-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.p7tm-tab:hover {
    color: #2C2C2C;
    background: #F5F3ED;
}

.p7tm-tab.active {
    color: #5C6B55;
    border-bottom-color: #5C6B55;
}

.p7tm-tab svg {
    width: 18px;
    height: 18px;
}

/* ===== STATS ===== */
.p7tm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.p7tm-stat-card {
    background: #5C6B55;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    color: white;
}

.p7tm-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.p7tm-stat-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ===== CARDS ===== */
.p7tm-card {
    background: white;
    border: 1px solid #E8E5E0;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

.p7tm-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2C2C2C;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.p7tm-card-title svg {
    width: 20px;
    height: 20px;
    color: #5C6B55;
}

.p7tm-card-count {
    color: #666;
    font-size: 0.9rem;
}

/* ===== FILTERS ===== */
.p7tm-filters {
    padding: 1rem 1.5rem;
    background: #F5F3ED;
    border-bottom: 1px solid #E8E5E0;
}

.p7tm-filter-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.p7tm-filter-group {
    min-width: 150px;
}

.p7tm-filter-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.4rem;
}

.p7tm-filter-search {
    flex: 1;
    min-width: 200px;
}

/* ===== INPUTS ===== */
.p7tm-input,
.p7tm-select {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 1px solid #E8E5E0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
}

.p7tm-input:focus,
.p7tm-select:focus {
    outline: none;
    border-color: #5C6B55;
    box-shadow: 0 0 0 3px rgba(92, 107, 85, 0.1);
}

/* ===== BUTTONS ===== */
.p7tm-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.p7tm-btn svg {
    width: 16px;
    height: 16px;
}

.p7tm-btn-primary {
    background: #5C6B55;
    color: white;
}

.p7tm-btn-primary:hover {
    background: #4a5a44;
}

.p7tm-btn-primary:disabled {
    background: #a0a0a0;
    cursor: not-allowed;
}

.p7tm-btn-secondary {
    background: white;
    color: #2C2C2C;
    border: 1px solid #E8E5E0;
}

.p7tm-btn-secondary:hover {
    background: #F5F3ED;
}

.p7tm-btn-danger {
    background: #dc3545;
    color: white;
}

.p7tm-btn-danger:hover {
    background: #c82333;
}

.p7tm-btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* ===== BULK BAR ===== */
.p7tm-bulk-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #F5F3ED;
    border-bottom: 1px solid #E8E5E0;
    flex-wrap: wrap;
    gap: 1rem;
}

.p7tm-bulk-info {
    font-weight: 600;
    color: #2C2C2C;
}

.p7tm-bulk-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.p7tm-bulk-actions .p7tm-select {
    width: auto;
    min-width: 200px;
}

/* ===== TABLE ===== */
.p7tm-table-wrapper {
    overflow-x: auto;
}

.p7tm-table {
    width: 100%;
    border-collapse: collapse;
}

.p7tm-table th,
.p7tm-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #E8E5E0;
}

.p7tm-table th {
    background: #F5F3ED;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.p7tm-table tr:hover {
    background: #FAFAF8;
}

.p7tm-col-check {
    width: 40px;
}

.p7tm-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #5C6B55;
}

.p7tm-contact-email {
    font-weight: 600;
    color: #2C2C2C;
}

.p7tm-contact-name {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.2rem;
}

/* ===== BADGES ===== */
.p7tm-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.p7tm-badge-available {
    background: #e8f5e9;
    color: #2e7d32;
}

.p7tm-badge-imported {
    background: #e3f2fd;
    color: #1565c0;
}

.p7tm-badge-affiliate {
    background: #fff3e0;
    color: #e65100;
}

/* ===== CUSTOMER LIST ===== */
.p7tm-customer-list {
    padding: 0;
}

.p7tm-customer-row {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E8E5E0;
    gap: 1rem;
    transition: background 0.2s;
}

.p7tm-customer-row:hover {
    background: #FAFAF8;
}

.p7tm-customer-row:last-child {
    border-bottom: none;
}

.p7tm-customer-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #5C6B55;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.p7tm-customer-info {
    flex: 1;
    min-width: 0;
}

.p7tm-customer-email {
    font-weight: 600;
    color: #2C2C2C;
    word-break: break-word;
}

.p7tm-customer-meta {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.2rem;
}

.p7tm-customer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.p7tm-move-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #E8E5E0;
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 180px;
    background: white;
}

.p7tm-move-select:focus {
    outline: none;
    border-color: #5C6B55;
}

/* ===== EMPTY STATE ===== */
.p7tm-empty-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.p7tm-empty-icon {
    margin-bottom: 1rem;
}

.p7tm-empty-icon svg {
    width: 48px;
    height: 48px;
    color: #ccc;
}

.p7tm-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2C2C2C;
    margin: 0 0 0.5rem 0;
}

.p7tm-empty-text {
    margin: 0;
    font-size: 0.95rem;
}

/* ===== HISTORY ===== */
.p7tm-history-list {
    padding: 0;
}

.p7tm-history-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E8E5E0;
}

.p7tm-history-item:last-child {
    border-bottom: none;
}

.p7tm-history-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #5C6B55;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.p7tm-history-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.p7tm-history-content {
    flex: 1;
}

.p7tm-history-action {
    font-weight: 600;
    color: #2C2C2C;
}

.p7tm-history-details {
    color: #666;
    font-size: 0.9rem;
}

.p7tm-history-time {
    color: #999;
    font-size: 0.85rem;
}

/* ===== MODAL ===== */
.p7tm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.p7tm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.p7tm-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: translateY(-20px);
    transition: transform 0.2s;
}

.p7tm-modal-overlay.active .p7tm-modal {
    transform: translateY(0);
}

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

.p7tm-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2C2C2C;
    margin: 0;
}

.p7tm-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p7tm-modal-close:hover {
    background: #F5F3ED;
}

.p7tm-modal-close svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.p7tm-modal-body {
    padding: 1.5rem;
}

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

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

.p7tm-form-group:last-child {
    margin-bottom: 0;
}

.p7tm-form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2C2C2C;
    margin-bottom: 0.5rem;
}

.p7tm-form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #E8E5E0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.p7tm-form-select:focus {
    outline: none;
    border-color: #5C6B55;
    box-shadow: 0 0 0 3px rgba(92, 107, 85, 0.1);
}

/* ===== TOAST ===== */
.p7tm-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 999999;
    animation: p7tm-slide-in 0.3s ease;
}

.p7tm-toast-success {
    background: #4caf50;
}

.p7tm-toast-error {
    background: #f44336;
}

@keyframes p7tm-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== UTILITIES ===== */
.p7tm-text-muted {
    color: #999;
    font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .p7tm-title {
        font-size: 1.5rem;
    }
    
    .p7tm-tabs {
        flex-wrap: wrap;
    }
    
    .p7tm-tab {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .p7tm-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .p7tm-filter-group {
        width: 100%;
    }
    
    .p7tm-bulk-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .p7tm-bulk-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .p7tm-bulk-actions .p7tm-select,
    .p7tm-bulk-actions .p7tm-btn {
        width: 100%;
    }
    
    .p7tm-table {
        font-size: 0.85rem;
    }
    
    .p7tm-table th,
    .p7tm-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .p7tm-customer-row {
        flex-wrap: wrap;
    }
    
    .p7tm-customer-actions {
        width: 100%;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid #E8E5E0;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .p7tm-move-select {
        flex: 1;
        min-width: 120px;
    }
}
