/* 
 * Main CSS File
 * Modern Japanese-inspired design system for enterprise SaaS
 */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Noto+Sans+Mono+JP&display=swap');

/* Import component styles */
@import './components.css';
@import './styles.css';

/* ==========================================================================
   Design Tokens & Variables
   ========================================================================== */

:root {
  /* Typography */
  --font-primary: 'Noto Sans JP', 'Inter', sans-serif;
  --font-mono: 'Noto Sans Mono JP', monospace;
  
  /* Spacing Scale */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  
  /* Animation */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

html {
  @apply antialiased;
  font-feature-settings: "palt";  /* Japanese text spacing */
}

body {
  @apply bg-background text-text-primary font-sans;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   Typography
   ========================================================================== */

/* Headings */
h1, .h1 {
  @apply text-3xl md:text-4xl font-bold leading-tight tracking-tight;
}

h2, .h2 {
  @apply text-2xl md:text-3xl font-bold leading-tight;
}

h3, .h3 {
  @apply text-xl md:text-2xl font-semibold leading-snug;
}

h4, .h4 {
  @apply text-lg md:text-xl font-semibold leading-snug;
}

h5, .h5 {
  @apply text-base md:text-lg font-semibold leading-snug;
}

h6, .h6 {
  @apply text-sm md:text-base font-semibold leading-snug;
}

/* Body Text */
.text-body-large {
  @apply text-lg leading-relaxed;
}

.text-body {
  @apply text-base leading-relaxed;
}

.text-body-small {
  @apply text-sm leading-relaxed;
}

.text-caption {
  @apply text-xs leading-relaxed text-text-tertiary;
}

/* Japanese Text Optimization */
.ja-text {
  @apply tracking-wide;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   Links & Interactive Elements
   ========================================================================== */

a {
  @apply text-primary hover:text-primary-700 transition-colors duration-200;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Focus Styles */
:focus-visible {
  @apply outline-none ring-2 ring-primary/20 ring-offset-2;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

/* Input Base */
.input-base {
  @apply w-full px-4 py-2.5 text-sm bg-surface border border-neutral-200 rounded-lg
         focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary
         transition-colors duration-200;
}

/* Input Variants */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  @apply input-base;
}

/* Input States */
.input-error {
  @apply border-danger-500 focus:ring-danger-500/20 focus:border-danger-500;
}

.input-success {
  @apply border-success-500 focus:ring-success-500/20 focus:border-success-500;
}

.input-disabled {
  @apply bg-neutral-50 text-text-disabled cursor-not-allowed;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

/* Button Base */
.btn {
  @apply inline-flex items-center justify-center px-4 py-2.5 text-sm font-medium
         rounded-lg transition-all duration-200
         focus:outline-none focus:ring-2 focus:ring-offset-2
         disabled:opacity-50 disabled:cursor-not-allowed
         will-change-transform transform-gpu;
}

/* Button Variants */
.btn-primary {
  @apply btn bg-primary text-white hover:bg-primary-700
         focus:ring-primary/20 active:bg-primary-800;
}

.btn-secondary {
  @apply btn bg-white text-text-primary border border-neutral-200
         hover:bg-neutral-50 focus:ring-neutral-500/20
         active:bg-neutral-100;
}

.btn-danger {
  @apply btn bg-danger-500 text-white hover:bg-danger-600
         focus:ring-danger-500/20 active:bg-danger-700;
}

.btn-ghost {
  @apply btn text-text-primary hover:bg-neutral-100
         focus:ring-neutral-500/20 active:bg-neutral-200;
}

/* Button Sizes */
.btn-sm {
  @apply px-3 py-1.5 text-xs;
}

.btn-lg {
  @apply px-5 py-3 text-base;
}

/* Button with Icon */
.btn-icon {
  @apply p-2 rounded-lg;
}

/* ==========================================================================
   Cards & Containers
   ========================================================================== */

.card {
  @apply bg-surface rounded-lg border border-neutral-200 shadow-card
         transition-shadow duration-200 hover:shadow-card-hover;
}

.card-header {
  @apply p-4 border-b border-neutral-200;
}

.card-body {
  @apply p-4;
}

.card-footer {
  @apply p-4 border-t border-neutral-200;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Text */
.text-truncate {
  @apply overflow-hidden text-ellipsis whitespace-nowrap;
}

.text-balance {
  text-wrap: balance;
}

/* Accessibility */
.visually-hidden {
  @apply sr-only;
}

.focus-ring {
  @apply focus:outline-none focus:ring-2 focus:ring-primary/20 focus:ring-offset-2;
}

/* Transitions */
.transition-transform {
  @apply transition-transform duration-200 will-change-transform;
}

.transition-opacity {
  @apply transition-opacity duration-200 will-change-opacity;
}

/* ==========================================================================
   Responsive Utilities
   ========================================================================== */

.container-narrow {
  @apply max-w-3xl mx-auto px-4;
}

.container-wide {
  @apply max-w-7xl mx-auto px-4;
}

/* ==========================================================================
   Package Scrolling Utilities
   ========================================================================== */

/* Hide scrollbars completely */
.category-scroll-container {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  scroll-behavior: smooth;
}

.category-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Scrollbar hide utility */
.scrollbar-hide {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Category wrapper */
.category-wrapper {
  position: relative;
}

/* Category scroll buttons */
.category-scroll-left,
.category-scroll-right {
  transition: all 0.2s ease;
  will-change: opacity, transform;
}

.category-scroll-left:hover:not(:disabled),
.category-scroll-right:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.category-scroll-left:active:not(:disabled),
.category-scroll-right:active:not(:disabled) {
  transform: translateY(-50%) scale(0.95);
}

/* Package card animations */
.package-card {
  transition: all 0.2s ease;
  will-change: transform, box-shadow;
}

.package-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Line clamp utility */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .category-scroll-left,
  .category-scroll-right {
    opacity: 0.7;
  }
  
  .category-wrapper:hover .category-scroll-left,
  .category-wrapper:hover .category-scroll-right {
    opacity: 1;
  }
  
  .package-card {
    min-width: 240px !important;
  }
}

@media (max-width: 640px) {
  .package-card {
    min-width: 200px !important;
    max-width: 220px !important;
  }
}

/* ==========================================================================
   Pagination Styles
   ========================================================================== */

#packages-pagination {
  background: linear-gradient(to top, theme('colors.background.alt'), theme('colors.surface'));
}

#packages-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#packages-pagination button:not(:disabled):hover {
  background-color: theme('colors.neutral.50');
}

/* Page number buttons */
#pagination-numbers button {
  min-width: 40px;
  font-weight: 500;
}

#pagination-numbers button:hover:not(.bg-primary) {
  background-color: theme('colors.neutral.50');
}

/* Mobile pagination */
@media (max-width: 640px) {
  #packages-pagination .sm\\:hidden button {
    flex: 1;
    justify-content: center;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    @apply bg-white text-black;
  }
  
  .table-responsive {
    @apply overflow-visible;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
  }
} 