/**
 * Mine Tilbud - Moderne Design
 * Vedbod.no stil med mobil-first approach
 * 
 * @version 1.0
 * @date 2025-12-17
 */

/* =============================================================================
   CSS VARIABLER
   ============================================================================= */

.atm-section {
    --atm-primary: #2c5530;
    --atm-primary-light: #3a7042;
    --atm-primary-dark: #1e3d22;
    --atm-success: #22c55e;
    --atm-success-bg: #dcfce7;
    --atm-warning: #f59e0b;
    --atm-warning-bg: #fef3c7;
    --atm-danger: #ef4444;
    --atm-danger-bg: #fee2e2;
    --atm-gray-50: #f9fafb;
    --atm-gray-100: #f3f4f6;
    --atm-gray-200: #e5e7eb;
    --atm-gray-300: #d1d5db;
    --atm-gray-500: #6b7280;
    --atm-gray-600: #4b5563;
    --atm-gray-700: #374151;
    --atm-gray-900: #111827;
    --atm-radius-sm: 8px;
    --atm-radius-md: 12px;
    --atm-radius-lg: 16px;
    --atm-radius-xl: 20px;
    --atm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --atm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --atm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   SECTION CONTAINER
   ============================================================================= */

.atm-section {
    background: var(--atm-gray-50);
    padding: 24px;
    border-radius: var(--atm-radius-xl);
    margin-bottom: 24px;
}

/* =============================================================================
   HEADER
   ============================================================================= */

.atm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.atm-header-content {
    flex: 1;
    min-width: 200px;
}

.atm-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--atm-gray-900);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.atm-subtitle {
    font-size: 0.9rem;
    color: var(--atm-gray-500);
    margin: 0;
}

/* =============================================================================
   STATISTIKK - Moderne kort med gradient
   ============================================================================= */

.atm-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.atm-stat {
    background: white;
    border-radius: var(--atm-radius-md);
    padding: 16px 12px;
    text-align: center;
    box-shadow: var(--atm-shadow-sm);
    border: 1px solid var(--atm-gray-200);
    transition: all 0.2s ease;
}

.atm-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--atm-shadow-md);
}

.atm-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--atm-gray-900);
    line-height: 1;
    margin-bottom: 4px;
}

.atm-stat-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--atm-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stat varianter */
.atm-stat-pending {
    border-left: 4px solid var(--atm-warning);
}

.atm-stat-pending .atm-stat-value {
    color: var(--atm-warning);
}

.atm-stat-success {
    border-left: 4px solid var(--atm-success);
}

.atm-stat-success .atm-stat-value {
    color: var(--atm-success);
}

/* =============================================================================
   FILTER CHIPS - Horisontal scroll på mobil
   ============================================================================= */

.atm-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.atm-filters::-webkit-scrollbar {
    display: none;
}

.atm-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid var(--atm-gray-200);
    background: white;
    color: var(--atm-gray-600);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.atm-chip:hover {
    border-color: var(--atm-primary);
    color: var(--atm-primary);
}

.atm-chip-active,
.atm-chip.atm-chip-active {
    background: var(--atm-primary);
    border-color: var(--atm-primary);
    color: white;
}

/* Aktiv chip beholder hvit tekst ved hover */
.atm-chip-active:hover,
.atm-chip.atm-chip-active:hover {
    background: var(--atm-primary-dark);
    border-color: var(--atm-primary-dark);
    color: white;
}

/* =============================================================================
   TILBUDSKORT - Moderne cards med status-indikator
   ============================================================================= */

.atm-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.atm-card {
    background: white;
    border-radius: var(--atm-radius-lg);
    box-shadow: var(--atm-shadow-sm);
    border: 1px solid var(--atm-gray-200);
    overflow: hidden;
    transition: all 0.2s ease;
}

.atm-card:hover {
    box-shadow: var(--atm-shadow-md);
    transform: translateY(-1px);
}

/* Status-fargede venstrekanter */
.atm-card-sendt {
    border-left: 4px solid var(--atm-warning);
}

.atm-card-akseptert {
    border-left: 4px solid var(--atm-success);
    background: linear-gradient(135deg, #f0fdf4 0%, white 50%);
}

.atm-card-avslått {
    border-left: 4px solid var(--atm-danger);
    opacity: 0.85;
}

.atm-card-utlopt {
    border-left: 4px solid var(--atm-gray-400);
    opacity: 0.7;
}

/* Card Header */
.atm-card-header {
    padding: 16px 16px 8px;
}

.atm-card-title-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.atm-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.atm-card-title a {
    color: var(--atm-gray-900);
    text-decoration: none;
    transition: color 0.2s;
}

.atm-card-title a:hover {
    color: var(--atm-primary);
}

/* Status Badges */
.atm-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.atm-badge-sendt {
    background: var(--atm-warning-bg);
    color: #92400e;
}

.atm-badge-akseptert {
    background: var(--atm-success-bg);
    color: #166534;
}

.atm-badge-avslatt {
    background: var(--atm-danger-bg);
    color: #991b1b;
}

.atm-badge-utlopt {
    background: var(--atm-gray-200);
    color: var(--atm-gray-600);
}

/* Card Details */
.atm-card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 16px 12px;
}

.atm-detail {
    font-size: 0.8rem;
    color: var(--atm-gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Tilbud Summary - Fremhevet prisseksjon */
.atm-tilbud-summary {
    background: var(--atm-gray-50);
    padding: 12px 16px;
    border-top: 1px solid var(--atm-gray-100);
    border-bottom: 1px solid var(--atm-gray-100);
}

.atm-tilbud-my-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.atm-price-label {
    font-size: 0.85rem;
    color: var(--atm-gray-500);
}

.atm-price-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--atm-primary);
}

.atm-price-delivery {
    font-size: 0.85rem;
    color: var(--atm-gray-500);
}

/* Card Actions */
.atm-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
    flex-wrap: wrap;
}

/* =============================================================================
   KNAPPER
   ============================================================================= */

.atm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--atm-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    white-space: nowrap;
}

.atm-btn-primary {
    background: var(--atm-primary);
    color: white;
    border-color: var(--atm-primary);
}

.atm-btn-primary:hover {
    background: var(--atm-primary-dark);
    border-color: var(--atm-primary-dark);
    color: white;
}

.atm-btn-outline {
    background: white;
    color: var(--atm-gray-700);
    border-color: var(--atm-gray-300);
}

.atm-btn-outline:hover {
    background: var(--atm-gray-50);
    border-color: var(--atm-primary);
    color: var(--atm-primary);
}

.atm-btn-danger-outline {
    background: white;
    color: var(--atm-danger);
    border-color: var(--atm-danger);
}

.atm-btn-danger-outline:hover {
    background: var(--atm-danger);
    color: white;
}

/* =============================================================================
   RESPONSIVE - MOBIL
   ============================================================================= */

@media (max-width: 768px) {
    .atm-section {
        padding: 16px;
        border-radius: var(--atm-radius-lg);
        margin: 0 -8px 16px;
    }
    
    .atm-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .atm-header .atm-btn {
        width: 100%;
    }
    
    .atm-title {
        font-size: 1.25rem;
    }
    
    /* Statistikk - kompakt på mobil */
    .atm-stats {
        gap: 8px;
    }
    
    .atm-stat {
        padding: 12px 8px;
    }
    
    .atm-stat-value {
        font-size: 1.5rem;
    }
    
    .atm-stat-label {
        font-size: 0.65rem;
    }
    
    /* Kort - full bredde */
    .atm-card-header {
        padding: 12px 12px 8px;
    }
    
    .atm-card-title-wrap {
        flex-direction: column;
        gap: 8px;
    }
    
    .atm-card-title {
        font-size: 0.95rem;
    }
    
    .atm-card-details {
        padding: 0 12px 10px;
        gap: 8px;
    }
    
    .atm-tilbud-summary {
        padding: 10px 12px;
    }
    
    .atm-price-value {
        font-size: 1.1rem;
    }
    
    .atm-card-actions {
        padding: 10px 12px 12px;
        gap: 6px;
    }
    
    .atm-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
        flex: 1;
        min-width: 0;
    }
    
    /* Chips - mindre på mobil */
    .atm-chip {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .atm-section {
        padding: 12px;
        margin: 0 -4px 12px;
    }
    
    /* Statistikk - enda mer kompakt */
    .atm-stat {
        padding: 10px 6px;
    }
    
    .atm-stat-value {
        font-size: 1.25rem;
    }
    
    /* Actions - stacker vertikalt */
    .atm-card-actions {
        flex-direction: column;
    }
    
    .atm-card-actions .atm-btn {
        width: 100%;
    }
    
    .atm-tilbud-my-price {
        flex-direction: column;
        gap: 4px;
    }
}

/* =============================================================================
   DARK MODE SUPPORT (optional)
   ============================================================================= */

@media (prefers-color-scheme: dark) {
    .atm-section {
        /* Uncomment for dark mode
        --atm-gray-50: #1f2937;
        --atm-gray-100: #374151;
        --atm-gray-200: #4b5563;
        --atm-gray-900: #f9fafb;
        */
    }
}

/* =============================================================================
   ANIMASJONER
   ============================================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.atm-card {
    animation: fadeIn 0.3s ease-out;
}

.atm-card:nth-child(1) { animation-delay: 0.05s; }
.atm-card:nth-child(2) { animation-delay: 0.1s; }
.atm-card:nth-child(3) { animation-delay: 0.15s; }
.atm-card:nth-child(4) { animation-delay: 0.2s; }
.atm-card:nth-child(5) { animation-delay: 0.25s; }

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

.atm-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--atm-gray-500);
}

.atm-empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.atm-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--atm-gray-700);
    margin-bottom: 8px;
}

.atm-empty-text {
    font-size: 0.9rem;
    margin-bottom: 20px;
}
