/* ============================================
   ShadCN UI-Inspired Design System
   Gift Issuance System - Custom CSS
   ============================================ */

/* Design Tokens - CSS Variables */
:root {
    /* Colors */
    --background: #ffffff;
    --foreground: #020817;
    --card: #ffffff;
    --card-foreground: #020817;
    --popover: #ffffff;
    --popover-foreground: #020817;
    --primary: #0f172a;
    --primary-foreground: #f8fafc;
    --secondary: #f1f5f9;
    --secondary-foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent: #f1f5f9;
    --accent-foreground: #0f172a;
    --destructive: #ef4444;
    --destructive-foreground: #f8fafc;
    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #0f172a;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Radius */
    --radius: 0.5rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    /* Spacing */
    --header-height: 65px;
    --sidebar-width: 260px;
    --footer-height: 52px;
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--foreground);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* ============================================
   BUTTON COMPONENTS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: #1e293b;
    border-color: #1e293b;
    box-shadow: var(--shadow);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--foreground);
    border-color: var(--border);
}

.btn-outline-primary:hover {
    background-color: var(--accent);
    color: var(--accent-foreground);
}

.btn-outline-danger {
    background-color: transparent;
    color: var(--destructive);
    border-color: var(--border);
}

.btn-outline-danger:hover {
    background-color: var(--destructive);
    color: white;
    border-color: var(--destructive);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn i {
    font-size: 1rem;
}

/* ============================================
   FORM COMPONENTS
   ============================================ */

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    display: block;
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--foreground);
    background-color: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--ring);
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

.form-control::placeholder {
    color: var(--muted-foreground);
}

.form-control:disabled {
    background-color: var(--muted);
    opacity: 0.5;
    cursor: not-allowed;
}

.text-danger {
    color: var(--destructive) !important;
}

.text-muted {
    color: var(--muted-foreground) !important;
    font-size: 0.8125rem;
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

.card {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    background-color: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--card-foreground);
    margin-bottom: 0.25rem;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ============================================
   TABLE COMPONENTS
   ============================================ */

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead th {
    background-color: var(--muted);
    color: var(--muted-foreground);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--muted);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
}

/* ============================================
   BADGE COMPONENTS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    line-height: 1;
}

.badge.bg-success {
    background-color: #10b981;
    color: white;
}

.badge.bg-danger {
    background-color: var(--destructive);
    color: white;
}

.badge.bg-info {
    background-color: #3b82f6;
    color: white;
}

.badge.bg-warning {
    background-color: #f59e0b;
    color: white;
}

/* ============================================
   ALERT COMPONENTS
   ============================================ */

.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: var(--destructive);
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

/* ============================================
   MODAL COMPONENTS
   ============================================ */

.modal-content {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background-color: var(--muted);
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--foreground);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
}

.btn-login:hover {
    background-color: #1e293b;
    box-shadow: var(--shadow);
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

.dashboard-page {
    background-color: #f8fafc;
    min-height: 100vh;
}

/* Dashboard Header */
.dashboard-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 1.5rem;
    max-width: 100%;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--foreground);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: background-color 0.2s;
}

.mobile-menu-toggle:hover {
    background-color: var(--muted);
}

.header-left h4 {
    color: var(--foreground);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--muted);
    border-radius: var(--radius-md);
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
}

.user-info i {
    font-size: 1.25rem;
    color: var(--muted-foreground);
}

.logout-btn {
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: #1e293b;
    color: white;
    box-shadow: var(--shadow);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    width: var(--sidebar-width);
    background: var(--card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 999;
    box-shadow: var(--shadow-sm);
}

.sidebar-content {
    padding: 1rem 0;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar .nav-link:hover {
    color: var(--foreground);
    background-color: var(--muted);
}

.sidebar .nav-link.active {
    color: #ffffff !important;
    background-color: #212529 !important;
    border-left: 3px solid #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sidebar .nav-link.active:hover {
    color: #ffffff !important;
    background-color: #212529 !important;
    border-left: 3px solid #ffffff;
}

.sidebar .nav-link i {
    font-size: 1.125rem;
    width: 1.25rem;
    flex-shrink: 0;
}

.sidebar .nav-link .bi-chevron-down {
    margin-left: auto;
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.sidebar .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    background-color: rgba(0, 0, 0, 0.02);
    padding: 0.5rem 0;
}

.submenu .nav-item {
    padding-left: 0;
}

.submenu-link {
    padding-left: 3.25rem !important;
    font-size: 0.8125rem !important;
    background-color: transparent;
    transition: all 0.2s ease;
}

.submenu-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sidebar .submenu-link.active,
.sidebar .submenu .nav-link.active {
    color: #ffffff !important;
    background-color: #212529 !important;
    border-left: 3px solid #ffffff !important;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin: 2px 0;
}

.sidebar .submenu-link.active:hover,
.sidebar .submenu .nav-link.active:hover {
    color: #ffffff !important;
    background-color: #212529 !important;
    border-left: 3px solid #ffffff !important;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* Dashboard Footer */
.dashboard-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    background: var(--card);
    border-top: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 -1px 3px 0 rgb(0 0 0 / 0.05);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 1.5rem;
}

.footer-content p {
    color: var(--muted-foreground);
    font-size: 0.8125rem;
    margin: 0;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

/* ============================================
   BREADCRUMB NAVIGATION
   ============================================ */

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
    font-size: 0.875rem;
    display: flex;
    flex-wrap: wrap;
    list-style: none;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    padding-right: 0.5rem;
    color: var(--muted-foreground);
    font-size: 1.2rem;
    font-weight: 300;
}

.breadcrumb-item a {
    color: var(--muted-foreground);
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--foreground);
    font-weight: 600;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--foreground);
    line-height: 1;
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: var(--muted-foreground);
    opacity: 0.5;
}

/* ============================================
   UTILITIES
   ============================================ */

.text-center {
    text-align: center;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

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

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

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--muted-foreground);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: 260px;
        max-width: 80%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
        background: var(--card);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .header-left h4 {
        font-size: 1rem;
    }
    
    .header-left .app-title {
        display: none;
    }
    
    .user-info span {
        display: none;
    }
    
    .logout-btn span {
        display: none;
    }
}
