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

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  html {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
  }

  body {
    @apply bg-gray-50 text-gray-900 antialiased;
  }
}

@layer components {
  /* === CARDS === */
  .card {
    @apply bg-white rounded-lg border border-gray-200 shadow-sm;
  }

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

  .stat-card {
    @apply bg-white rounded-lg border border-gray-200 shadow-sm p-6;
  }

  /* === BUTTONS === */
  .btn-primary {
    @apply inline-flex items-center justify-center px-4 py-2.5 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2;
  }

  .btn-secondary {
    @apply inline-flex items-center justify-center px-4 py-2.5 bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2;
  }

  .btn-danger {
    @apply inline-flex items-center justify-center px-4 py-2.5 bg-red-600 hover:bg-red-700 text-white text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2;
  }

  .btn-success {
    @apply inline-flex items-center justify-center px-4 py-2.5 bg-emerald-600 hover:bg-emerald-700 text-white text-sm font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2;
  }

  .btn-ghost {
    @apply inline-flex items-center justify-center px-4 py-2.5 text-gray-600 hover:text-gray-900 hover:bg-gray-100 text-sm font-medium rounded-lg transition-colors duration-200;
  }

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

  .btn-sm {
    @apply px-3 py-1.5 text-xs;
  }

  /* === FORM INPUTS === */
  .input-field {
    @apply w-full px-3 py-2 border border-gray-300 rounded-lg text-sm bg-white focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-all duration-200 placeholder:text-gray-400;
  }

  .input-label {
    @apply block text-sm font-medium text-gray-700 mb-1.5;
  }

  .input-error {
    @apply mt-1 text-xs text-red-600;
  }

  .select-field {
    @apply w-full px-3 py-2 border border-gray-300 rounded-lg text-sm bg-white focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-all duration-200;
  }

  .textarea-field {
    @apply w-full px-3 py-2 border border-gray-300 rounded-lg text-sm bg-white focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-all duration-200 resize-y;
  }

  /* === BADGES === */
  .badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
  }

  .badge-gray { @apply bg-gray-100 text-gray-800; }
  .badge-yellow { @apply bg-yellow-100 text-yellow-800; }
  .badge-blue { @apply bg-blue-100 text-blue-800; }
  .badge-green { @apply bg-green-100 text-green-800; }
  .badge-red { @apply bg-red-100 text-red-800; }
  .badge-purple { @apply bg-purple-100 text-purple-800; }
  .badge-indigo { @apply bg-indigo-100 text-indigo-800; }

  /* === TABLES === */
  .table-container {
    @apply overflow-x-auto;
  }

  .table {
    @apply w-full text-sm text-left;
  }

  .table thead {
    @apply bg-gray-50 border-b border-gray-200;
  }

  .table thead th {
    @apply px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider;
  }

  .table tbody tr {
    @apply border-b border-gray-100 hover:bg-gray-50;
  }

  .table tbody td {
    @apply px-4 py-3;
  }

  /* === ALERTS === */
  .alert {
    @apply p-4 rounded-lg border;
  }

  .alert-success {
    @apply bg-green-50 border-green-200 text-green-800;
  }

  .alert-error {
    @apply bg-red-50 border-red-200 text-red-800;
  }

  .alert-warning {
    @apply bg-yellow-50 border-yellow-200 text-yellow-800;
  }

  .alert-info {
    @apply bg-blue-50 border-blue-200 text-blue-800;
  }

  /* === PAGE LAYOUT === */
  .page-header {
    @apply mb-6;
  }

  .page-title {
    @apply text-xl font-semibold text-gray-900;
  }

  .page-subtitle {
    @apply mt-1 text-sm text-gray-500;
  }

  /* === SIDEBAR === */
  .sidebar {
    @apply w-64 h-screen bg-slate-900 text-white fixed left-0 top-0 z-40 overflow-y-auto;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar::-webkit-scrollbar {
    width: 4px;
  }

  .sidebar::-webkit-scrollbar-track {
    background: transparent;
  }

  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
  }

  .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
  }

  .sidebar-overlay {
    @apply fixed inset-0 bg-black/50 z-40 lg:hidden;
  }

  .sidebar-nav a {
    @apply flex items-center px-4 py-2.5 text-gray-300 hover:text-white hover:bg-white/10 text-sm transition-colors duration-150 rounded-lg mx-2;
  }

  .sidebar-nav a.active {
    @apply bg-white/10 text-white;
  }

  .sidebar-nav a svg {
    @apply w-5 h-5 mr-3 flex-shrink-0;
  }

  /* === SIDEBAR DROPDOWN (Admin & Vendor) === */
  .sidebar-dropdown-wrapper {
    margin: 0;
  }
  .sidebar-dropdown-wrapper button.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  .sidebar-dropdown-content a {
    display: flex;
    align-items: center;
  }
  .rotate-180 {
    transform: rotate(180deg);
  }

  .vendor-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.625rem 1rem;
    color: #d1d5db;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
  }

  .vendor-dropdown-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }

  .vendor-dropdown-open .vendor-dropdown-btn {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }

  .vendor-chevron {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
  }

  .vendor-dropdown-open .vendor-chevron {
    transform: rotate(180deg);
  }

  .vendor-dropdown-items {
    display: none;
    padding: 0.25rem 0;
  }

  .vendor-dropdown-open .vendor-dropdown-items {
    display: block;
  }

  .vendor-dropdown-link {
    display: block;
    padding: 0.5rem 0.75rem;
    margin-left: 2rem;
    color: #9ca3af;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
    text-decoration: none;
  }

  .vendor-dropdown-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
  }

  .vendor-dropdown-active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
  }

  /* === MAIN CONTENT WRAPPER === */
  .main-content {
    @apply min-h-screen bg-gray-50 flex-1;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* === TOOLTIPS === */
  [data-tooltip] {
    position: relative;
  }
  [data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  [data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #0f172a;
    z-index: 9999;
    pointer-events: none;
  }

  .main-content-full {
    @apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8;
  }

  /* === GRIDS === */
  .grid-stats-4 {
    @apply grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4;
  }

  .grid-stats-3 {
    @apply grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4;
  }

  .grid-2col {
    @apply grid grid-cols-1 lg:grid-cols-2 gap-4;
  }

  /* === DIVIDERS === */
  .divider {
    @apply border-t border-gray-200 my-6;
  }

  /* === EMPTY STATE === */
  .empty-state {
    @apply text-center py-12;
  }

  .empty-state-icon {
    @apply w-12 h-12 mx-auto text-gray-400 mb-4;
  }

  .empty-state-title {
    @apply text-lg font-medium text-gray-900 mb-1;
  }

  .empty-state-text {
    @apply text-sm text-gray-500;
  }

  .royal-card {
    @apply bg-white rounded-xl border border-gray-200 shadow-sm;
  }

  .royal-card table thead {
    @apply bg-gray-50 border-b border-gray-200;
  }

  .royal-card table thead th {
    @apply text-sm font-semibold text-gray-600;
  }

  .royal-btn {
    @apply px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded-lg transition-colors duration-200;
  }

  .product-card {
    @apply bg-white rounded-2xl overflow-hidden shadow-sm hover:shadow-xl transition-all duration-300 border border-gray-100;
  }

  .product-card .product-image-wrapper {
    @apply relative overflow-hidden aspect-square bg-gray-100;
  }

  .product-card .product-image-wrapper img {
    @apply w-full h-full object-cover transition-transform duration-500;
  }

  .product-card .product-image-wrapper:hover img {
    @apply scale-110;
  }
}

@layer utilities {
  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

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

  @keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .animate-fade-in {
    animation: fade-in 0.3s ease-out;
  }

  .primary-gradient {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  }

  .text-gradient {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* === BANNER === */
  .banner-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
  }
  @media (min-width: 1024px) {
    .banner-wrapper {
      grid-template-columns: calc(100% - 392px) 362px;
    }
  }
  .banner__card .swiper {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
  }
  .banner__card .swiper-slide {
    border-radius: 12px;
  }
  .hero-text {
    background-size: cover;
    background-position: center;
    min-height: 480px;
    display: flex;
    align-items: center;
    position: relative;
    border-radius: 12px;
  }
  .hero-text::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
    border-radius: 12px;
  }
  .hero-content {
    position: relative;
    z-index: 10;
    padding: 0 3rem;
    max-width: 420px;
  }
  .hero-content .subtitle {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fb923c;
    margin-bottom: 0.75rem;
  }
  .hero-content .title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 1rem;
  }
  @media (min-width: 1024px) {
    .hero-content .title {
      font-size: 2.25rem;
    }
  }
  .hero-content .desc {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  .banner-btn .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #4f46e5;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.2s;
  }
  .banner-btn .btn-primary:hover {
    background: #4338ca;
  }
  .custom-navigation {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
  }
  .banner-button-prev,
  .banner-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2) !important;
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: auto;
    cursor: pointer;
    opacity: 1;
    transition: all 0.3s;
    border: none !important;
  }
  .banner-button-prev:hover,
  .banner-button-next:hover {
    background: rgba(255,255,255,0.4) !important;
  }
  .banner-button-prev {
    left: 16px;
  }
  .banner-button-next {
    right: 16px;
  }
  .banner-button-prev::after,
  .banner-button-next::after {
    display: none !important;
  }
  .heroAds-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
  }
  .heroAds-single {
    background-size: cover;
    background-position: center;
    min-height: 220px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: flex-end;
    cursor: pointer;
    transition: box-shadow 0.3s;
  }
  .heroAds-single:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  }
  .heroAds-single-item {
    position: relative;
    z-index: 10;
    padding: 1.5rem;
    width: 100%;
  }
  .heroAds-single-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 100%);
    z-index: -1;
    border-radius: 0 0 12px 12px;
  }
  .heroAds-single-item .subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fb923c;
    display: block;
    margin-bottom: 0.25rem;
  }
  .heroAds-single-item .title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.75rem;
  }
  .heroAds-single-item .shop-btn .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #4f46e5;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.75rem;
    text-decoration: none;
    transition: background 0.2s;
  }
  .heroAds-single-item .shop-btn .btn-primary:hover {
    background: #4338ca;
  }
}
