/* MuffinMarket Web Components - Reusable UI Components */

/* ===== NOTIFICATIONS ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--white);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    z-index: var(--z-modal);
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.notification-success {
    border-left-color: var(--success);
}

.notification-error {
    border-left-color: var(--error);
}

.notification-warning {
    border-left-color: var(--warning);
}

.notification-info {
    border-left-color: var(--info);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
}

.notification-message {
    flex: 1;
    color: var(--text-primary);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.notification-close:hover {
    background-color: var(--gray-100);
    color: var(--text-primary);
}

/* ===== LOADING SPINNER ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

.spinner-large {
    width: 40px;
    height: 40px;
    border-width: 3px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border-width: 1px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background-color: var(--primary);
    color: var(--white);
}

.badge-secondary {
    background-color: var(--secondary);
    color: var(--white);
}

.badge-success {
    background-color: var(--success);
    color: var(--white);
}

.badge-error {
    background-color: var(--error);
    color: var(--white);
}

.badge-warning {
    background-color: var(--warning);
    color: var(--white);
}

.badge-info {
    background-color: var(--info);
    color: var(--white);
}

.badge-outline {
    background-color: transparent;
    border: 1px solid var(--gray-300);
    color: var(--text-secondary);
}

/* ===== ALERTS ===== */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border-left: 4px solid;
}

.alert-primary {
    background-color: rgba(236, 134, 27, 0.1);
    border-left-color: var(--primary);
    color: var(--text-primary);
}

.alert-secondary {
    background-color: rgba(139, 69, 19, 0.1);
    border-left-color: var(--secondary);
    color: var(--text-primary);
}

.alert-success {
    background-color: rgba(76, 175, 80, 0.1);
    border-left-color: var(--success);
    color: var(--text-primary);
}

.alert-error {
    background-color: rgba(244, 67, 54, 0.1);
    border-left-color: var(--error);
    color: var(--text-primary);
}

.alert-warning {
    background-color: rgba(255, 152, 0, 0.1);
    border-left-color: var(--warning);
    color: var(--text-primary);
}

.alert-info {
    background-color: rgba(33, 150, 243, 0.1);
    border-left-color: var(--info);
    color: var(--text-primary);
}

/* ===== TOOLTIPS ===== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--muffin-dark-brown);
    color: var(--muffin-cream);
    text-align: center;
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    position: absolute;
    z-index: var(--z-tooltip);
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-size: var(--text-xs);
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--muffin-dark-brown) transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    margin: auto;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--gray-200);
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--gray-100);
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: var(--space-lg);
}

.modal-footer {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-200);
}

/* ===== TABS ===== */
.tabs {
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--space-lg);
}

.tab-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tab-item {
    margin-right: var(--space-sm);
}

.tab-button {
    background: none;
    border: none;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    font-weight: var(--font-medium);
}

.tab-button:hover {
    color: var(--primary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== ACCORDION ===== */
.accordion {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid var(--gray-200);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    background: none;
    border: none;
    width: 100%;
    padding: var(--space-md);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: var(--font-medium);
    color: var(--text-primary);
    transition: background-color var(--transition-fast);
}

.accordion-header:hover {
    background-color: var(--gray-50);
}

.accordion-icon {
    transition: transform var(--transition-fast);
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0 var(--space-md);
    max-height: 0;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.accordion-content.active {
    padding: var(--space-md);
    max-height: 500px;
}

/* ===== PROGRESS BARS ===== */
.progress {
    width: 100%;
    height: 8px;
    background-color: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-normal);
}

.progress-bar-success {
    background-color: var(--success);
}

.progress-bar-error {
    background-color: var(--error);
}

.progress-bar-warning {
    background-color: var(--warning);
}

.progress-bar-info {
    background-color: var(--info);
}

/* ===== BREADCRUMBS ===== */
.breadcrumb {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: var(--text-sm);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    margin: 0 var(--space-sm);
    color: var(--gray-400);
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-link:hover {
    color: var(--primary);
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: var(--font-medium);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin: var(--space-lg) 0;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--gray-300);
    background-color: var(--white);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-weight: var(--font-medium);
}

.pagination-item:hover {
    background-color: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--text-primary);
}

.pagination-item.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-item.disabled:hover {
    background-color: var(--white);
    border-color: var(--gray-300);
    color: var(--text-secondary);
}

/* ===== RESPONSIVE COMPONENTS ===== */
@media (max-width: 768px) {
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .modal-content {
        margin: 10px;
        width: calc(100% - 20px);
        max-width: none;
    }
    
    .tab-list {
        flex-direction: column;
    }
    
    .tab-item {
        margin-right: 0;
        margin-bottom: var(--space-xs);
    }
    
    .pagination {
        flex-wrap: wrap;
    }
}

/* ===== EMAIL PROVIDER BUTTONS ===== */
.email-provider-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.btn-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    border: 1px solid #dadce0;
    border-radius: var(--radius-md);
    background: #ffffff;
    color: #1f1f1f;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12);
}

.btn-provider:hover {
    background: #f8f9fa;
    border-color: #c6c6c6;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.2);
}

.btn-provider:active {
    background: #f1f3f4;
}

.provider-icon-img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

/* Gmail — Google sign-in style: white surface, neutral text, full-color G icon in SVG */
.gmail-btn {
    border-color: #dadce0;
    color: #1f1f1f;
}

.gmail-btn:hover {
    background: #f8f9fa;
    color: #1f1f1f;
    border-color: #c6c6c6;
}

/* Outlook — Microsoft neutral button + blue icon asset */
.outlook-btn {
    border-color: #d1d1d1;
    color: #242424;
}

.outlook-btn:hover {
    background: #f5f5f5;
    color: #242424;
    border-color: #b3b3b3;
}

/* Yahoo — neutral button + purple icon asset */
.yahoo-btn {
    border-color: #d1d1d1;
    color: #242424;
}

.yahoo-btn:hover {
    background: #faf8fc;
    color: #242424;
    border-color: #c9b8d9;
}

/* Button States */
.btn-provider:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-provider.loading {
    pointer-events: none;
}

.btn-provider.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    right: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .email-provider-buttons {
        gap: 10px;
    }
    
    .btn-provider {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn-provider .provider-icon {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .btn-provider {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .btn-provider .provider-icon {
        font-size: 16px;
    }
}
