/* Costs Section Styles */
/* Dashboard-style layout for costs and sales metrics */

/* ==========================================
   SECTION BASE STYLES
   ========================================== */

#costs-section {
    padding-top: 100px;
    padding-bottom: 100px;
    min-height: 100vh;
}

#summaries-section {
    padding-top: 100px;
    padding-bottom: 100px;
    min-height: 100vh;
}

.costs-dashboard {
    margin: 0 auto;
    padding: 0 24px;
}

/* ==========================================
   DATE FILTER CONTROLS
   ========================================== */

.costs-date-filter {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 32px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.costs-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.costs-filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
}

.costs-date-input {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.costs-date-input:focus {
    outline: none;
    border-color: #8E31BB;
    box-shadow: 0 0 0 3px rgba(142, 49, 187, 0.1);
}

.costs-filter-btn,
.costs-reset-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.costs-filter-btn {
    background: #8E31BB;
    color: white;
}

.costs-filter-btn:hover {
    background: #7c2a9f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 49, 187, 0.3);
}

.costs-reset-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.costs-reset-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* ==========================================
   STATS GRID (4 Panels)
   ========================================== */

.costs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* For summaries section, use 4 columns for sales row, flexible for others */
#summaries-section .costs-stats-grid {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1400px) {
    #summaries-section .costs-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #summaries-section .costs-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   STAT CARD STYLES
   ========================================== */

.costs-stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.costs-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.costs-stat-card-1::before {
    background: linear-gradient(90deg, #E85E53 0%, #f87171 100%);
}

.costs-stat-card-2::before {
    background: linear-gradient(90deg, #8E31BB 0%, #a855f7 100%);
}

.costs-stat-card-3::before {
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
}

.costs-stat-card-4::before {
    background: linear-gradient(90deg, #66ADD6 0%, #93c5fd 100%);
}

.costs-stat-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.costs-stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.costs-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.costs-stat-card-1 .costs-stat-icon {
    background: rgba(232, 94, 83, 0.1);
    color: #E85E53;
}

.costs-stat-card-2 .costs-stat-icon {
    background: rgba(142, 49, 187, 0.1);
    color: #8E31BB;
}

.costs-stat-card-3 .costs-stat-icon {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.costs-stat-card-4 .costs-stat-icon {
    background: rgba(102, 173, 214, 0.1);
    color: #66ADD6;
}

.costs-stat-title {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.costs-stat-value {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.costs-stat-amount {
    font-size: 32px;
    font-weight: 800;
    color: #1a1a2e;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    word-wrap: break-word;
}

.costs-stat-note {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    line-height: 1.4;
}

.costs-stat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    flex: 1;
}

.costs-stat-placeholder i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.costs-stat-placeholder p {
    font-size: 14px;
    margin: 0;
    color: #6b7280;
}

/* ==========================================
   PANELS GRID (2 Half-Width Panels)
   ========================================== */

.costs-panels-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ==========================================
   PANEL STYLES
   ========================================== */

.costs-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.costs-panel:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.costs-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.costs-add-btn {
    padding: 8px 16px;
    background: #8E31BB;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.costs-add-btn:hover {
    background: #7c2a9f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 49, 187, 0.3);
}

.costs-panel-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.costs-panel-title-wrapper i {
    font-size: 20px;
    color: #8E31BB;
}

.costs-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

.costs-panel-content {
    padding: 24px;
    flex: 1;
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.costs-panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #9ca3af;
    flex: 1;
}

.costs-panel-placeholder i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.costs-panel-placeholder p {
    font-size: 15px;
    margin: 0;
    color: #6b7280;
}

.costs-recent-sales-list,
.costs-low-stock-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================
   COSTS LIST STYLES
   ========================================== */

.costs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.costs-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.costs-list-item:hover {
    background: #f3f4f6;
    border-color: rgba(142, 49, 187, 0.2);
    transform: translateX(4px);
}

.costs-list-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.costs-list-item-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.costs-list-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #6b7280;
}

.costs-list-item-amount {
    font-size: 18px;
    font-weight: 700;
    color: #E85E53;
    margin-left: 12px;
}

.costs-list-item-actions {
    display: flex;
    gap: 8px;
}

.costs-edit-btn,
.costs-delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.costs-edit-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.costs-edit-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.costs-delete-btn {
    background: #fee2e2;
    color: #dc2626;
}

.costs-delete-btn:hover {
    background: #fecaca;
    color: #b91c1c;
}

/* ==========================================
   COST MODAL STYLES
   ========================================== */

.cost-form {
    padding: 24px;
}

.cost-form .form-group {
    margin-bottom: 20px;
}

.cost-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.cost-form input[type="text"],
.cost-form input[type="number"],
.cost-form input[type="date"],
.cost-form select,
.cost-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.cost-form input:focus,
.cost-form select:focus,
.cost-form textarea:focus {
    outline: none;
    border-color: #8E31BB;
    box-shadow: 0 0 0 3px rgba(142, 49, 187, 0.1);
}

.cost-form textarea {
    resize: vertical;
    font-family: inherit;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #8E31BB;
    color: white;
}

.btn-primary:hover {
    background: #7c2a9f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(142, 49, 187, 0.3);
}

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-secondary:hover {
    background: #e5e7eb;
    color: #374151;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes costsSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Panel animations when section becomes active */
#costs-section.active .costs-stat-card {
    animation: costsSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: calc(var(--animation-order, 1) * 0.1s);
    opacity: 0;
}

#costs-section.active .costs-panel {
    animation: costsSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

#costs-section.active .costs-date-filter {
    animation: costsSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

#summaries-section.active .costs-stat-card {
    animation: costsSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: calc(var(--animation-order, 1) * 0.1s);
    opacity: 0;
}

#summaries-section.active .costs-panel {
    animation: costsSlideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.5s;
    opacity: 0;
}

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

@media (max-width: 1200px) {
    .costs-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .costs-panels-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #costs-section,
    #summaries-section {
        padding-top: 90px;
    }

    .costs-date-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .costs-filter-group {
        width: 100%;
    }

    .costs-filter-btn,
    .costs-reset-btn {
        width: 100%;
    }
    
    .costs-dashboard {
        padding: 0 16px;
    }
    
    .costs-stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .costs-stat-card {
        padding: 20px;
    }
    
    .costs-stat-amount {
        font-size: 28px;
    }
    
    .costs-panel-content {
        min-height: 250px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .costs-stat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .costs-stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .costs-stat-amount {
        font-size: 24px;
    }
    
    .costs-panel-placeholder i {
        font-size: 48px;
    }
}

/* ==========================================
   DARK MODE SUPPORT
   ========================================== */

body.dark-mode #costs-section,
body.dark-mode #summaries-section {
    background: #0a0a0a;
}

body.dark-mode .costs-date-filter {
    background: #171717;
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .costs-date-input {
    background: #262626;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f1f1f1;
}

body.dark-mode .costs-date-input:focus {
    border-color: #8E31BB;
}

body.dark-mode .costs-reset-btn {
    background: #262626;
    color: #a3a3a3;
}

body.dark-mode .costs-reset-btn:hover {
    background: #404040;
    color: #e5e5e5;
}

body.dark-mode .costs-list-item {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .costs-list-item:hover {
    background: #262626;
    border-color: rgba(142, 49, 187, 0.3);
}

body.dark-mode .costs-list-item-name {
    color: #f1f1f1;
}

body.dark-mode .costs-list-item-meta {
    color: #9ca3af;
}

body.dark-mode .costs-edit-btn {
    background: #262626;
    color: #a3a3a3;
}

body.dark-mode .costs-edit-btn:hover {
    background: #404040;
    color: #e5e5e5;
}

body.dark-mode .cost-form label {
    color: #e5e5e5;
}

body.dark-mode .cost-form input[type="text"],
body.dark-mode .cost-form input[type="number"],
body.dark-mode .cost-form input[type="date"],
body.dark-mode .cost-form select,
body.dark-mode .cost-form textarea {
    background: #262626;
    border-color: rgba(255, 255, 255, 0.1);
    color: #f1f1f1;
}

body.dark-mode .cost-form input:focus,
body.dark-mode .cost-form select:focus,
body.dark-mode .cost-form textarea:focus {
    border-color: #8E31BB;
}

body.dark-mode .form-actions {
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .btn-secondary {
    background: #262626;
    color: #a3a3a3;
}

body.dark-mode .btn-secondary:hover {
    background: #404040;
    color: #e5e5e5;
}

body.dark-mode .costs-stat-card,
body.dark-mode .costs-panel {
    background: #171717;
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .costs-stat-card:hover,
body.dark-mode .costs-panel:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

body.dark-mode .costs-stat-title,
body.dark-mode .costs-panel-title {
    color: #f1f1f1;
}

body.dark-mode .costs-stat-amount {
    color: #f1f1f1;
}

body.dark-mode .costs-stat-placeholder,
body.dark-mode .costs-panel-placeholder {
    color: #9ca3af;
}

body.dark-mode .costs-stat-placeholder p,
body.dark-mode .costs-panel-placeholder p {
    color: #6b7280;
}

body.dark-mode .costs-panel-header {
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .costs-panel-title-wrapper i {
    color: #8E31BB;
}
