/* ============================================
   BUDGET STYLES - Desktop & Tablet
   ============================================ */

.budget-section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  /* Käytä täysi leveys, ei max-width rajoitetta */
  width: 100%;
}

@media (min-width: 1400px) {
  .budget-section {
    padding: 2.5rem 3rem;
  }
}

.budget-header {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.budget-title-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.budget-controls-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Desktop layout - controls in row */
@media (min-width: 1024px) {
  .budget-controls-section {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.budget-header h2 {
  font-size: 2.4rem;
  color: #333;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
}

.budget-header h2::before {
  content: '📊';
  font-size: 3rem;
}

/* Current view indicator */
.budget-current-view {
  margin-bottom: 1.5rem;
  padding: 0.8rem 1.2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.budget-view-indicator {
  font-size: 1.3rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.budget-view-indicator::before {
  content: '👁️';
  font-size: 1.6rem;
}

/* Enhanced Filters */
/* Budget Filters */
.budget-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

/* Desktop - filters in single row */
@media (min-width: 1024px) {
  .budget-filters {
    flex-wrap: nowrap;
    gap: 1.5rem;
  }
}

.budget-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 120px;
}

.budget-filter-group label {
  font-size: 1.2rem;
  font-weight: 500;
  color: #666;
}

.budget-filter-group select {
  padding: 0.8rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1.3rem;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.budget-filter-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(102, 187, 106, 0.2);
}

/* Legacy month selector (keep for compatibility) */
.budget-month-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.budget-month-selector select {
  padding: 0.8rem 1.5rem;
  font-size: 1.4rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  color: #333;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.budget-month-selector select:hover {
  border-color: var(--color-primary);
}

.budget-month-selector select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

/* Budget Overall Card */
.budget-overall {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 2rem;
  color: white;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  animation: fadeIn 0.4s ease-in, slideUp 0.4s ease-out;
}

.budget-overall-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.budget-overall-title {
  font-size: 1.6rem;
  font-weight: 500;
  opacity: 0.9;
}

.budget-overall-amount {
  text-align: right;
}

.budget-overall-spent {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

/* Color coding for overall spent amounts */
.budget-overall-spent[data-status='good'] {
  color: #43a047;
}

.budget-overall-spent[data-status='warning'] {
  color: #fb8c00;
}

.budget-overall-spent[data-status='danger'] {
  color: #e53935;
}

.budget-overall-total {
  font-size: 1.4rem;
  opacity: 0.8;
  margin-top: 0.5rem;
}

.budget-overall-progress {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.budget-overall-progress-bar {
  height: 100%;
  background: white;
  border-radius: 6px;
  transition: width 0.5s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.budget-overall-percentage {
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
}

/* Budget Display Mode Buttons */
.budget-display-mode {
  display: flex;
  gap: 0.5rem;
  background: #f5f5f5;
  padding: 0.4rem;
  border-radius: 10px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.btn-display-mode {
  padding: 0.8rem 1.5rem;
  font-size: 1.3rem;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  color: #666;
  white-space: nowrap;
}

.btn-display-mode:hover {
  background: rgba(255, 255, 255, 0.5);
  color: #333;
}

.btn-display-mode.active {
  background: white;
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Budget Actions */
.budget-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn-budget {
  padding: 1rem 2rem;
  font-size: 1.4rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn-budget-primary {
  background: var(--color-primary);
  color: white;
}

.btn-budget-primary:hover {
  background: var(--color-primary-darker);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 187, 106, 0.3);
}

.btn-budget-secondary {
  background: white;
  color: #333;
  border: 2px solid #ddd;
}

.btn-budget-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

/* Category Budgets */
.budget-categories {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  animation: fadeIn 0.4s ease-in;
}

/* Responsive grid for larger screens */
@media (min-width: 768px) {
  .budget-categories {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .budget-categories {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1400px) {
  .budget-categories {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1800px) {
  .budget-categories {
    grid-template-columns: repeat(5, 1fr);
  }
}

.budget-category-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.2rem 1.5rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
  animation: slideUp 0.4s ease-out;
  animation-fill-mode: both;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.budget-category-card:nth-child(1) {
  animation-delay: 0.05s;
}
.budget-category-card:nth-child(2) {
  animation-delay: 0.1s;
}
.budget-category-card:nth-child(3) {
  animation-delay: 0.15s;
}
.budget-category-card:nth-child(4) {
  animation-delay: 0.2s;
}
.budget-category-card:nth-child(5) {
  animation-delay: 0.25s;
}
.budget-category-card:nth-child(6) {
  animation-delay: 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.budget-category-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.budget-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.budget-category-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.budget-category-icon {
  font-size: 2rem;
}

.budget-category-amounts {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.budget-category-spent {
  font-size: 1.8rem;
  font-weight: 700;
  color: #333;
}

/* Color coding for category spent amounts */
.budget-category-spent[data-status='good'] {
  color: #43a047;
}

.budget-category-spent[data-status='warning'] {
  color: #fb8c00;
}

.budget-category-spent[data-status='danger'] {
  color: #e53935;
}

.budget-category-total {
  font-size: 1.3rem;
  color: #666;
  font-weight: 500;
  text-align: right;
}

.budget-category-progress {
  width: 100%;
  height: 6px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.budget-category-progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background-color 0.3s;
}

/* Progress bar colors based on percentage */
.budget-category-progress-bar[data-status='good'] {
  background: linear-gradient(90deg, #66bb6a, #43a047);
}

.budget-category-progress-bar[data-status='warning'] {
  background: linear-gradient(90deg, #ffa726, #fb8c00);
}

.budget-category-progress-bar[data-status='danger'] {
  background: linear-gradient(90deg, #ef5350, #e53935);
}

.budget-category-percentage {
  font-size: 1.4rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  background: #f0f0f0;
}

.budget-category-percentage[data-status='good'] {
  color: #43a047;
  background: #e8f5e9;
}

.budget-category-percentage[data-status='warning'] {
  color: #fb8c00;
  background: #fff3e0;
}

.budget-category-percentage[data-status='danger'] {
  color: #e53935;
  background: #ffebee;
}

.budget-category-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.btn-category-action {
  background: transparent;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-category-action:hover {
  background: #f5f5f5;
  border-color: var(--color-primary);
  transform: scale(1.1);
}

.btn-category-action.btn-delete:hover {
  background: #ffebee;
  border-color: #e53935;
}

/* Empty State */
.budget-empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.budget-empty-state-icon {
  font-size: 6rem;
  margin-bottom: 1.5rem;
  opacity: 0.3;
}

.budget-empty-state h3 {
  font-size: 2rem;
  color: #666;
  margin-bottom: 1rem;
}

.budget-empty-state p {
  font-size: 1.4rem;
  color: #999;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* Budget Modal */
.budget-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.budget-modal.active {
  display: flex;
}

.budget-modal-content {
  background: white;
  border-radius: 16px;
  padding: 3rem;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.budget-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.budget-modal-title {
  font-size: 2.2rem;
  font-weight: 600;
  color: #333;
}

.budget-modal-close {
  background: none;
  border: none;
  font-size: 2.8rem;
  color: #999;
  cursor: pointer;
  transition: all 0.3s;
  line-height: 1;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.budget-modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.budget-form-group {
  margin-bottom: 2rem;
}

.budget-form-label {
  display: block;
  font-size: 1.4rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.8rem;
}

.budget-form-input,
.budget-form-select {
  width: 100%;
  padding: 1.2rem;
  font-size: 1.5rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: all 0.3s;
  font-family: inherit;
}

.budget-form-input:focus,
.budget-form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(102, 187, 106, 0.2);
}

.budget-form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
}

.budget-form-help {
  font-size: 1.2rem;
  color: #6c757d;
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.4;
}

.btn-budget-submit {
  flex: 1;
  padding: 1.2rem 2rem;
  font-size: 1.5rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-budget-submit-primary {
  background: var(--color-primary);
  color: white;
}

.btn-budget-submit-primary:hover {
  background: var(--color-primary-darker);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 187, 106, 0.3);
}

.btn-budget-submit-cancel {
  background: white;
  color: #666;
  border: 2px solid #ddd;
}

.btn-budget-submit-cancel:hover {
  background: #f5f5f5;
  border-color: #999;
}

/* Hidden class */
.hidden {
  display: none !important;
}

/* Tertiary button style */
.btn-budget-tertiary {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.btn-budget-tertiary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

/* Flexible button layout */
.budget-actions {
  flex-wrap: wrap;
}

/* No budgets message */
.budget-no-budgets {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 12px;
  margin: 2rem 0;
}

.budget-no-budgets-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
}

.budget-no-budgets h3 {
  color: #2d3748;
  margin-bottom: 1rem;
  font-size: 2rem;
}

.budget-no-budgets p {
  color: #4a5568;
  margin-bottom: 2rem;
  font-size: 1.6rem;
}

.budget-no-budgets .btn-budget {
  margin: 0 0.5rem;
}

/* Mobile responsive - alle 480px */
@media (max-width: 480px) {
  .budget-controls {
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
  }

  .btn-budget {
    padding: 1.2rem 1.5rem;
    font-size: 1.4rem;
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .btn-budget i {
    margin-right: 0.8rem;
  }

  /* Varmistetaan että kaikki painikkeet ovat samanlaisia */
  .btn-budget-primary,
  .btn-budget-secondary,
  .btn-budget-tertiary {
    width: 100%;
    padding: 1.2rem 1.5rem !important;
    font-size: 1.4rem !important;
    justify-content: center;
    text-align: center;
    min-height: 4.8rem;
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    line-height: 1.2;
  }

  /* Varmistetaan että span-elementit eivät vaikuta kokoon */
  .btn-budget span {
    display: inline-block;
    width: auto;
    margin-right: 0.8rem;
  }

  /* Display mode painikkeet mobiilissa */
  .budget-display-mode {
    justify-content: center;
    padding: 0.3rem;
  }

  .btn-display-mode {
    padding: 1rem 1.2rem;
    font-size: 1.3rem;
    flex: 1;
    justify-content: center;
  }
}

/* Tablet responsive - optimoidaan 770px leveyksille */
@media (min-width: 481px) and (max-width: 1023px) {
  .budget-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .budget-filter-group:last-child {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

/* Tablet responsive */
@media (min-width: 481px) and (max-width: 770px) {
  .budget-section {
    padding: 1.5rem !important;
  }

  .budget-header h2 {
    font-size: 2.2rem !important;
  }

  .budget-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .budget-filter-group:last-child {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .budget-categories {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.2rem !important;
  }
}

/* Tablet responsive */
@media (min-width: 768px) and (max-width: 1023px) {
  .budget-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .budget-filter-group:last-child {
    grid-column: 1 / -1;
    justify-self: center;
  }
}

/* Reset Modal Styles */
.reset-modal-body {
  padding: 2rem;
}

.reset-section {
  margin-bottom: 2rem;
}

.reset-section h4 {
  color: #333;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
}

.reset-options {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.reset-option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: white;
}

.reset-option:hover {
  border-color: #007bff;
  background-color: #f8f9ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.reset-option input[type='radio'] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: #007bff;
}

.reset-option input[type='radio']:checked + span {
  color: #007bff;
  font-weight: 600;
}

.reset-option input[type='radio']:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Enhanced checked state for radio buttons */
.reset-option:has(input[type='radio']:checked) {
  border-color: #007bff;
  background-color: #f0f8ff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.month-selector {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.category-selector {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.category-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.category-checkbox {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: white;
  position: relative;
}

.category-checkbox:hover {
  border-color: #007bff;
  background-color: #f8f9ff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.category-checkbox input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: #007bff;
}

.category-checkbox input[type='checkbox']:checked {
  accent-color: #007bff;
}

.category-checkbox input[type='checkbox']:checked + span {
  color: #007bff;
  font-weight: 600;
}

.category-checkbox input[type='checkbox']:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Enhanced checked state */
.category-checkbox:has(input[type='checkbox']:checked) {
  border-color: #007bff;
  background-color: #f0f8ff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.reset-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #e0e0e0;
}

.btn-budget-danger {
  background: linear-gradient(135deg, #dc3545, #c82333);
  color: white;
  border: none;
}

.btn-budget-danger:hover {
  background: linear-gradient(135deg, #c82333, #a71e2a);
  transform: translateY(-2px);
}

/* Mobile responsiveness for reset modal */
@media (max-width: 768px) {
  .reset-modal-body {
    padding: 1rem;
  }

  .category-checkboxes {
    grid-template-columns: 1fr;
  }

  .reset-actions {
    flex-direction: column;
  }

  .btn-budget-submit {
    width: 100%;
  }
}
