@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Premium Design Tokens - Professional Teal Theme */
  --color-primary: #14b8a6; /* Teal 500 - Professional & Fresh */
  --color-primary-light: #5eead4; /* Teal 300 */
  --color-primary-dark: #0f766e; /* Teal 700 */
  
  --color-accent: #f59e0b; /* Amber 500 - Warm Accent */
  --color-accent-light: #fbbf24; /* Amber 400 */
  
  --color-success: #22c55e; /* Green 500 */
  --color-warning: #facc15; /* Yellow 400 */
  --color-danger: #f43f5e; /* Rose 500 */

  --color-bg: #f8fafc; /* Slate 50 - Very Light Grey */
  --color-surface: #ffffff;
  --color-panel: rgba(255, 255, 255, 0.9);

  --color-text-main: #0f172a; /* Slate 900 */
  --color-text-muted: #64748b; /* Slate 500 */
  --color-text-on-primary: #ffffff;
  
  --color-border: #e2e8f0; /* Slate 200 */
  --color-border-hover: #cbd5e1; /* Slate 300 */

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Premium Elevation Shadows */
  --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px -4px rgba(20, 184, 166, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 15px rgba(20, 184, 166, 0.15);

  --font-main: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --header-height: 70px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-text-main);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

/* Glassmorphism Classes */

.glass {
  background: var(--color-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Enhanced Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease-in-out;
  font-size: 0.85rem;
  gap: 0.5rem;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-outline {
  background: white;
  border: 1px solid var(--color-border);
  color: var(--color-text-main);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(99, 102, 241, 0.04);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger) 0%, #b91c1c 100%);
  color: white;
}

/* Premium Cards */

.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-compact {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  border: 1px solid var(--color-border);
}

/* State-of-the-art Inputs */

.input {
  width: 100%;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: #ffffff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text-main);
}

.input:hover {
  border-color: var(--color-border-hover);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  background-color: white;
}

/* Modern Tables */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background: white;
  border: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
  background: white;
}

th {
  text-align: left;
  padding: 1.2rem 1rem;
  background-color: #f8fafc;
  color: var(--color-text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--color-border);
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-main);
  vertical-align: middle;
  transition: background-color 0.2s ease;
}

tr:hover td {
  background-color: rgba(20, 184, 166, 0.05); /* Teal Hover */
}

tr:last-child td {
  border-bottom: none;
}

/* Zebra Striping */

tr:nth-child(even) td {
  background-color: #fafbfc;
}

.table-compact th {
  padding: 0.4rem 0.6rem;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
}

.table-compact td {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

/* Badge Styles */

.badge {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.badge-success {
  background-color: #ecfdf5;
  color: #059669;
}

.badge-danger {
  background-color: #fef2f2;
  color: #dc2626;
}

.badge-warning {
  background-color: #fffbeb;
  color: #d97706;
}

/* Page Components */

.page-container {
  padding: 1.5rem;
  max-width: 1800px;
  margin: 0 auto;
  animation: slideUp 0.3s ease-out;
}

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

.page-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #0f172a;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Modal Overlay */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media print {

  /* Hide non-printable elements */
  .sidebar,
  .nav,
  .page-title,
  button,
  .btn,
  .badge,
  select {
    display: none !important;
  }

  /* Reset Layout */
  .page-container {
    padding: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }

  /* Inputs as Text */
  input {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    font-size: 1rem !important;
    color: #000 !important;
  }

  /* Expand textareas/inputs */
  input[type="text"],
  input[type="number"] {
    width: auto !important;
    min-width: 50px;
  }

  /* Specific Invoice Styling */
  h2 {
    font-size: 1.5rem !important;
    color: #000 !important;
    margin-bottom: 1rem !important;
  }

  label {
    font-weight: 700 !important;
    color: #333 !important;
    text-transform: uppercase;
    font-size: 0.75rem !important;
  }

  /* Table Styling */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  th {
    border-bottom: 2px solid #000 !important;
    color: #000 !important;
  }

  td {
    border-bottom: 1px solid #ddd !important;
    color: #000 !important;
  }

  /* Footer / Totals */
  h3 {
    font-size: 1.25rem !important;
    color: #000 !important;
  }

  /* Add Company Info (Visible only on print via pseudo-element or if added in component) */
  body::before {
    content: "COOLKIDZ - JUGUETERÍA | NIF: B12345678 | C/ Juguete 123, Madrid";
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 2rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 1rem;
    width: 100%;
  }

  /* Force background graphics if needed (adjust as per browser settings usually) */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Responsive Utilities */

@media (max-width: 1024px) {
  .page-container {
    padding: 1.5rem;
  }
}

@media (max-width: 768px) {
  .page-container {
    padding: 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .top-header {
    height: 50px;
    padding: 0 0.5rem;
  }

  /* Improve table scrolling on mobile */
  .table-container {
    position: relative;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  th,
  td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .page-container {
    padding: 0.75rem;
  }

  .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .input {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* Spinner Utility */

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spinner-rotate 0.6s linear infinite;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

/* Scrollbar Utilities */

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

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Remove spinner arrows from number inputs */

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Utility to remove spinner arrows from number inputs */

.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

.no-spinner {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Premium Action Buttons inside Tables */

.action-btn {
  width: 34px !important;
  height: 34px !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  outline: none !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  position: relative !important;
  border: 1px solid transparent !important;
}

.action-btn:hover {
  transform: translateY(-2px) scale(1.05) !important;
}

.action-btn:active {
  transform: translateY(0) scale(0.95) !important;
}

.action-btn svg {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.action-btn:hover svg {
  transform: scale(1.15) !important;
}

.action-btn-edit {
  color: #0284c7 !important;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border: 1px solid #bae6fd !important;
}

.action-btn-edit:hover {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%) !important;
  border: 1px solid #7dd3fc !important;
  color: #0369a1 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15), 0 2px 4px rgba(2, 132, 199, 0.05) !important;
}

.action-btn-adjust {
  color: #0d9488 !important;
  background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%) !important;
  border: 1px solid #99f6e4 !important;
}

.action-btn-adjust:hover {
  background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%) !important;
  border: 1px solid #5eead4 !important;
  color: #0f766e !important;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15), 0 2px 4px rgba(13, 148, 136, 0.05) !important;
}

.action-btn-history {
  color: #4f46e5 !important;
  background: linear-gradient(135deg, #f5f3ff 0%, #e0e7ff 100%) !important;
  border: 1px solid #c7d2fe !important;
}

.action-btn-history:hover {
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%) !important;
  border: 1px solid #a5b4fc !important;
  color: #4338ca !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15), 0 2px 4px rgba(79, 70, 229, 0.05) !important;
}.layout-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--color-bg);
}

/* Premium Floating Sidebar */
.sidebar {
    background: linear-gradient(180deg, #0f766e 0%, #1e293b 100%); /* Lightened Teal Gradient */
    color: white;
    display: flex;
    flex-direction: column;
    transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    border: 2.5px solid var(--color-primary);
    box-shadow: 0 0 20px rgba(20, 184, 166, 0.2), 12px 0 40px rgba(0, 0, 0, 0.2);
    z-index: 100;
    margin: 1.25rem;
    border-radius: var(--radius-lg);
    height: calc(100vh - 2.5rem);
    position: relative;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: radial-gradient(circle at top left, rgba(20, 184, 166, 0.1) 0%, transparent 70%);
    pointer-events: none;
}



.sidebar.open {
    width: 280px;
}

.sidebar.closed {
    width: 0;
    margin-left: 0;
}

.flags-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    margin: 1.25rem 0.75rem 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.flag-btn {
    opacity: 0.6;
    transition: all 0.2s ease;
    padding: 4px;
    border-radius: 4px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.flag-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.flag-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.flag-btn img {
    width: 24px;
    height: auto;
    border-radius: 2px;
}

/* Sidebar Logo Area */
.sidebar-logo {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-box {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(20, 184, 166, 0.3);
}

.sidebar-logo span {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

/* User Profile Section */
.sidebar-user {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05); 
    margin: 0.75rem;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--color-primary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: white;
}

.user-info .name {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
}

.user-info .role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.85rem;
}


.nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.nav-item.active {
    background: rgba(20, 184, 166, 0.2);
    color: white;
    border: 1.5px solid var(--color-primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.nav-item svg {
    color: inherit;
    transition: transform 0.3s ease;
}

.nav-item:hover svg {
    transform: scale(1.1);
}

.sidebar-footer {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.logout-btn {
    width: 100%;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.1);
    color: #fb7185;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.2);
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.user-info .role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 1.25rem 1.25rem 1.25rem 0;
}

.top-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 2.5rem;
    justify-content: space-between;
    background: white;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.menu-btn {
    width: 44px;
    height: 44px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-main);
    transition: all 0.3s ease;
}

.menu-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: rotate(90deg);
}

.content-scroll {
    flex: 1;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -320px;
        top: 0;
        bottom: 0;
        margin: 0;
        height: 100vh;
        width: 300px !important;
        border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
        z-index: 1000;
    }
    .sidebar.open { left: 0; }
    .main-content { padding: 1rem; }
}

@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.rotate-animation { animation: rotate 2s linear infinite; }
