# Ruby Calculator - Interactive calculator built with Ruby on Rails
# Author: RSK World (Molla Samser, Founder | Rima Khatun, Designer & Tester)
# Contact: help@rskworld.in | +91 93305 39277
# Website: https://rskworld.in
# Year: 2026
# Description: Build a fully functional calculator using Ruby on Rails with modern UI

class Theme
  THEMES = {
    default: {
      name: 'Default Purple',
      primary: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
      secondary: '#4a5568',
      accent: '#ed8936',
      success: '#48bb78',
      danger: '#e53e3e',
      warning: '#ecc94b',
      info: '#4299e1',
      background: '#f7fafc',
      text: '#2d3748',
      display: '#2d3748'
    },
    dark: {
      name: 'Dark Mode',
      primary: 'linear-gradient(135deg, #1a202c 0%, #2d3748 100%)',
      secondary: '#4a5568',
      accent: '#ed8936',
      success: '#48bb78',
      danger: '#e53e3e',
      warning: '#ecc94b',
      info: '#4299e1',
      background: '#1a202c',
      text: '#e2e8f0',
      display: '#2d3748'
    },
    ocean: {
      name: 'Ocean Blue',
      primary: 'linear-gradient(135deg, #0077be 0%, #004d7a 100%)',
      secondary: '#005a8b',
      accent: '#00a8cc',
      success: '#00a86b',
      danger: '#dc143c',
      warning: '#ffa500',
      info: '#1e90ff',
      background: '#f0f8ff',
      text: '#2c3e50',
      display: '#1a365d'
    },
    sunset: {
      name: 'Sunset Orange',
      primary: 'linear-gradient(135deg, #ff6b6b 0%, #feca57 100%)',
      secondary: '#ee5a24',
      accent: '#feca57',
      success: '#26de81',
      danger: '#eb3b5a',
      warning: '#fdcb6e',
      info: '#74b9ff',
      background: '#fff5f5',
      text: '#2d3436',
      display: '#d63031'
    },
    forest: {
      name: 'Forest Green',
      primary: 'linear-gradient(135deg, #27ae60 0%, #16a085 100%)',
      secondary: '#229954',
      accent: '#f39c12',
      success: '#27ae60',
      danger: '#e74c3c',
      warning: '#f1c40f',
      info: '#3498db',
      background: '#e8f8f5',
      text: '#1e5128',
      display: '#145a32'
    },
    candy: {
      name: 'Candy Pink',
      primary: 'linear-gradient(135deg, #ff6ec7 0%, #c471ed 100%)',
      secondary: '#d63031',
      accent: '#fd79a8',
      success: '#00b894',
      danger: '#d63031',
      warning: '#fdcb6e',
      info: '#74b9ff',
      background: '#ffeef8',
      text: '#2d3436',
      display: '#e84393'
    },
    midnight: {
      name: 'Midnight Blue',
      primary: 'linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%)',
      secondary: '#2c3e50',
      accent: '#e74c3c',
      success: '#27ae60',
      danger: '#e74c3c',
      warning: '#f39c12',
      info: '#3498db',
      background: '#0f0c29',
      text: '#ecf0f1',
      display: '#2c3e50'
    },
    minimal: {
      name: 'Minimal Gray',
      primary: 'linear-gradient(135deg, #636e72 0%, #2d3436 100%)',
      secondary: '#636e72',
      accent: '#0984e3',
      success: '#00b894',
      danger: '#d63031',
      warning: '#fdcb6e',
      info: '#74b9ff',
      background: '#ffffff',
      text: '#2d3436',
      display: '#636e72'
    }
  }
  
  def self.all
    THEMES
  end
  
  def self.get(theme_name)
    THEMES[theme_name.to_sym] || THEMES[:default]
  end
  
  def self.names
    THEMES.keys.map(&:to_s)
  end
  
  def self.apply_theme(theme_name)
    theme = get(theme_name)
    css_variables = []
    
    theme.each do |key, value|
      css_variable = "--theme-#{key}: #{value};"
      css_variables << css_variable
    end
    
    css_variables.join("\n")
  end
  
  def self.generate_css(theme_name)
    theme = get(theme_name)
    
    <<~CSS
      :root {
        #{apply_theme(theme_name)}
      }
      
      .calculator {
        background: var(--theme-primary);
      }
      
      .display {
        background: var(--theme-display);
        color: var(--theme-text);
      }
      
      .btn-number {
        background: var(--theme-secondary);
        color: var(--theme-text);
      }
      
      .btn-operator {
        background: var(--theme-accent);
        color: var(--theme-text);
      }
      
      .btn-scientific {
        background: var(--theme-info);
        color: var(--theme-text);
      }
      
      .btn-memory {
        background: var(--theme-success);
        color: var(--theme-text);
      }
      
      .btn-clear {
        background: var(--theme-danger);
        color: var(--theme-text);
      }
      
      .btn-equals {
        background: var(--theme-success);
        color: var(--theme-text);
      }
      
      body {
        background: var(--theme-background);
        color: var(--theme-text);
      }
    CSS
  end
end
