/**
 * Cost Savings Plugin - Main Stylesheet
 * Author: Stephen Burns | https://www.StephenBurns.net
 */

/* ================================================
   CSS VARIABLES & BASE STYLES
   ================================================ */

.cost-savings-wrapper {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-primary: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    --transition: all 0.2s ease;
    
    font-family: var(--font-primary);
    background: var(--background);
    padding: 30px 20px;
    box-sizing: border-box;
}

.cost-savings-wrapper *,
.cost-savings-wrapper *::before,
.cost-savings-wrapper *::after {
    box-sizing: border-box;
}

.cost-savings-wrapper .container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ================================================
   THEME SWITCHER
   ================================================ */

.cost-savings-wrapper .theme-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.cost-savings-wrapper .theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.cost-savings-wrapper .theme-btn:hover {
    transform: scale(1.1);
}

.cost-savings-wrapper .theme-btn.active {
    border-color: var(--primary-color);
    transform: scale(1.15);
}

.cost-savings-wrapper .theme-btn[data-theme="professional"] {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.cost-savings-wrapper .theme-btn[data-theme="modern-dark"] {
    background: linear-gradient(135deg, #1e1e2e 0%, #313244 100%);
}

.cost-savings-wrapper .theme-btn[data-theme="corporate-clean"] {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

.cost-savings-wrapper .theme-btn[data-theme="tech-terminal"] {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    border: 2px solid #22c55e;
}

.cost-savings-wrapper .theme-btn[data-theme="minimal-light"] {
    background: linear-gradient(135deg, #fafafa 0%, #e5e5e5 100%);
    border: 2px solid #a3a3a3;
}

/* ================================================
   HEADER
   ================================================ */

.cost-savings-wrapper .header {
    text-align: center;
    margin-bottom: 35px;
}

.cost-savings-wrapper .header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    letter-spacing: -0.02em;
}

.cost-savings-wrapper .header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ================================================
   STATISTICS DASHBOARD
   ================================================ */

.cost-savings-wrapper .stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 35px;
}

@media (max-width: 900px) {
    .cost-savings-wrapper .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .cost-savings-wrapper .stats-container {
        grid-template-columns: 1fr;
    }
}

.cost-savings-wrapper .stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.cost-savings-wrapper .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.cost-savings-wrapper .stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.cost-savings-wrapper .stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ================================================
   STICKY FILTERS
   ================================================ */

.cost-savings-wrapper .sticky-filters {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.cost-savings-wrapper .search-section {
    margin-bottom: 15px;
}

.cost-savings-wrapper .search-input-wrapper {
    position: relative;
}

.cost-savings-wrapper .main-search-input {
    width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: var(--font-primary);
}

.cost-savings-wrapper .main-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cost-savings-wrapper .main-search-input::placeholder {
    color: var(--text-muted);
}

.cost-savings-wrapper .filters-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* ================================================
   CATEGORY FILTER BUTTONS
   ================================================ */

.cost-savings-wrapper .category-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cost-savings-wrapper .category-btn {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: var(--font-primary);
}

.cost-savings-wrapper .category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.cost-savings-wrapper .category-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

/* ================================================
   SCROLL INDICATOR
   ================================================ */

.cost-savings-wrapper .scroll-indicator {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--primary-color);
    color: #ffffff;
    padding: 12px 25px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.cost-savings-wrapper .scroll-indicator.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cost-savings-wrapper .scroll-indicator:hover {
    background: var(--primary-hover);
}

.cost-savings-wrapper .scroll-arrow {
    width: 20px;
    height: 20px;
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* ================================================
   DATA TABLE
   ================================================ */

.cost-savings-wrapper .table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.cost-savings-wrapper .savings-table {
    width: 100% !important;
    border-collapse: collapse;
}

.cost-savings-wrapper .savings-table thead th {
    background: var(--surface-hover);
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding: 15px 12px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.cost-savings-wrapper .savings-table tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    vertical-align: middle;
}

.cost-savings-wrapper .savings-table tbody tr:hover {
    background: var(--surface-hover);
}

.cost-savings-wrapper .savings-table tbody tr:last-child td {
    border-bottom: none;
}

/* Amount Badge */
.cost-savings-wrapper .amount-badge {
    display: inline-block;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* Category Badges */
.cost-savings-wrapper .category-badge {
    display: inline-block;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 2px;
}

/* Details Button */
.cost-savings-wrapper .details-btn {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-primary);
}

.cost-savings-wrapper .details-btn:hover {
    background: var(--primary-hover);
}

.cost-savings-wrapper .details-btn.inline {
    background: transparent;
    color: var(--primary-color);
    padding: 2px 8px;
    font-size: 0.8rem;
    text-decoration: underline;
}

.cost-savings-wrapper .details-btn.inline:hover {
    background: rgba(37, 99, 235, 0.1);
}

.cost-savings-wrapper .truncated-text {
    color: var(--text-secondary);
}

/* DataTables overrides */
.cost-savings-wrapper .dataTables_wrapper {
    font-family: var(--font-primary);
}

.cost-savings-wrapper .dataTables_wrapper .dataTables_paginate {
    margin-top: 20px;
}

.cost-savings-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 8px 14px !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    margin: 0 3px !important;
}

.cost-savings-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--surface-hover) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.cost-savings-wrapper .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
}

.cost-savings-wrapper .dataTables_wrapper .dataTables_info {
    color: var(--text-secondary);
    padding-top: 15px;
}

.cost-savings-wrapper .dt-buttons {
    margin-bottom: 15px;
}

.cost-savings-wrapper .dt-buttons .dt-button {
    background: var(--surface) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    padding: 8px 16px !important;
    border-radius: var(--radius-sm) !important;
    font-family: var(--font-primary) !important;
    font-weight: 500 !important;
    margin-right: 8px !important;
    transition: var(--transition) !important;
}

.cost-savings-wrapper .dt-buttons .dt-button:hover {
    background: var(--surface-hover) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

/* ================================================
   DETAILS MODAL
   ================================================ */

.cost-savings-wrapper .details-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.cost-savings-wrapper .details-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.cost-savings-wrapper .details-modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.cost-savings-wrapper .details-modal-overlay.visible .details-modal {
    transform: scale(1);
}

.cost-savings-wrapper .details-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-hover);
}

.cost-savings-wrapper .details-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cost-savings-wrapper .details-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cost-savings-wrapper .details-modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.cost-savings-wrapper .details-modal-content {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.cost-savings-wrapper .details-modal-content p {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 1rem;
    margin: 0;
}

body.modal-open {
    overflow: hidden;
}

/* ================================================
   THEME: PROFESSIONAL (Default)
   ================================================ */

/* (Already defined in base styles) */

/* ================================================
   THEME: MODERN DARK
   ================================================ */

.cost-savings-wrapper.theme-modern-dark {
    --primary-color: #a78bfa;
    --primary-hover: #8b5cf6;
    --secondary-color: #94a3b8;
    --success-color: #34d399;
    --background: #0f0f23;
    --surface: #1e1e2e;
    --surface-hover: #313244;
    --border-color: #45475a;
    --text-primary: #cdd6f4;
    --text-secondary: #a6adc8;
    --text-muted: #6c7086;
}

.cost-savings-wrapper.theme-modern-dark .amount-badge {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

.cost-savings-wrapper.theme-modern-dark .category-badge {
    background: rgba(167, 139, 250, 0.2);
    color: #a78bfa;
}

/* ================================================
   THEME: CORPORATE CLEAN
   ================================================ */

.cost-savings-wrapper.theme-corporate-clean {
    --primary-color: #0891b2;
    --primary-hover: #0e7490;
    --secondary-color: #64748b;
    --success-color: #059669;
    --background: #f0fdfa;
    --surface: #ffffff;
    --surface-hover: #ecfeff;
    --border-color: #99f6e4;
    --text-primary: #134e4a;
    --text-secondary: #5eead4;
    --text-muted: #94a3b8;
}

.cost-savings-wrapper.theme-corporate-clean .stat-card {
    border-left: 4px solid var(--primary-color);
}

.cost-savings-wrapper.theme-corporate-clean .amount-badge {
    background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}

.cost-savings-wrapper.theme-corporate-clean .category-badge {
    background: rgba(8, 145, 178, 0.1);
    color: #0891b2;
}

/* ================================================
   THEME: TECH TERMINAL
   ================================================ */

.cost-savings-wrapper.theme-tech-terminal {
    --primary-color: #22c55e;
    --primary-hover: #16a34a;
    --secondary-color: #6b7280;
    --success-color: #22c55e;
    --background: #0a0a0a;
    --surface: #141414;
    --surface-hover: #1f1f1f;
    --border-color: #2a2a2a;
    --text-primary: #22c55e;
    --text-secondary: #86efac;
    --text-muted: #4ade80;
}

.cost-savings-wrapper.theme-tech-terminal {
    font-family: var(--font-mono);
}

.cost-savings-wrapper.theme-tech-terminal .header h1 {
    font-family: var(--font-mono);
}

.cost-savings-wrapper.theme-tech-terminal .header h1::before {
    content: '> ';
    color: var(--primary-color);
}

.cost-savings-wrapper.theme-tech-terminal .stat-card {
    border: 1px solid var(--primary-color);
    background: rgba(34, 197, 94, 0.05);
}

.cost-savings-wrapper.theme-tech-terminal .amount-badge {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.cost-savings-wrapper.theme-tech-terminal .category-badge {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.cost-savings-wrapper.theme-tech-terminal .category-btn {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.cost-savings-wrapper.theme-tech-terminal .category-btn.active {
    background: var(--primary-color);
    color: #000000;
}

.cost-savings-wrapper.theme-tech-terminal .details-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.cost-savings-wrapper.theme-tech-terminal .details-btn:hover {
    background: var(--primary-color);
    color: #000000;
}

/* ================================================
   THEME: MINIMAL LIGHT
   ================================================ */

.cost-savings-wrapper.theme-minimal-light {
    --primary-color: #525252;
    --primary-hover: #404040;
    --secondary-color: #737373;
    --success-color: #059669;
    --background: #fafafa;
    --surface: #ffffff;
    --surface-hover: #f5f5f5;
    --border-color: #e5e5e5;
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
}

.cost-savings-wrapper.theme-minimal-light .stat-card {
    box-shadow: none;
    border: 1px solid var(--border-color);
}

.cost-savings-wrapper.theme-minimal-light .amount-badge {
    background: var(--text-primary);
}

.cost-savings-wrapper.theme-minimal-light .category-badge {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.cost-savings-wrapper.theme-minimal-light .category-btn.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.cost-savings-wrapper.theme-minimal-light .details-btn {
    background: var(--text-primary);
}

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

@media (max-width: 768px) {
    .cost-savings-wrapper .header h1 {
        font-size: 1.8rem;
    }
    
    .cost-savings-wrapper .header p {
        font-size: 1rem;
    }
    
    .cost-savings-wrapper .sticky-filters {
        padding: 15px;
    }
    
    .cost-savings-wrapper .category-filter-group {
        justify-content: center;
    }
    
    .cost-savings-wrapper .category-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .cost-savings-wrapper .stat-number {
        font-size: 1.5rem;
    }
    
    .cost-savings-wrapper .stat-label {
        font-size: 0.8rem;
    }
    
    .cost-savings-wrapper .table-container {
        padding: 10px;
    }
    
    .cost-savings-wrapper .savings-table thead th,
    .cost-savings-wrapper .savings-table tbody td {
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .cost-savings-wrapper .details-modal {
        width: 95%;
        max-height: 90vh;
    }
}

/* Mobile card layout for tables */
@media (max-width: 600px) {
    .cost-savings-wrapper .savings-table thead {
        display: none;
    }
    
    .cost-savings-wrapper .savings-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 15px;
        background: var(--surface);
    }
    
    .cost-savings-wrapper .savings-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .cost-savings-wrapper .savings-table tbody td:last-child {
        border-bottom: none;
    }
    
    .cost-savings-wrapper .savings-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.8rem;
        text-transform: uppercase;
        flex-shrink: 0;
        margin-right: 15px;
    }
}

/* ================================================
   FOOTER ATTRIBUTION
   ================================================ */

.cost-savings-wrapper::after {
    content: 'Plugin by StephenBurns.net';
    display: block;
    text-align: center;
    margin-top: 30px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
