/* ============================================
   Kurumsal Admin Panel - Custom Styles
   Modern SaaS Dashboard Theme
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    --surface: #ffffff;
    --surface-secondary: #f8fafc;
    --border-light: #e2e8f0;
    --border-default: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-dropdown: 0 10px 40px -3px rgba(0, 0, 0, 0.12), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
    --shadow-sidebar: 4px 0 24px rgba(0, 0, 0, 0.15);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Alpine.js cloak --- */
[x-cloak] {
    display: none !important;
}

/* --- Custom scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Sidebar scrollbar */
aside::-webkit-scrollbar {
    width: 4px;
}
aside::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

/* --- Background Pattern --- */
.bg-pattern {
    background-image: radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.08) 1px, transparent 0);
    background-size: 24px 24px;
}

/* --- Sidebar Component --- */
.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    box-shadow: var(--shadow-sidebar);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    color: #94a3b8;
    position: relative;
}
.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.sidebar-item--active {
    background: rgba(99, 102, 241, 0.15) !important;
    color: white !important;
    border-left: 3px solid var(--primary-400);
    padding-left: calc(0.75rem - 3px);
}

/* --- Topbar Component --- */
.topbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
}

.topbar-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: white;
}

/* --- Breadcrumb --- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.breadcrumb a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}
.breadcrumb a:hover {
    color: var(--primary-600);
}
.breadcrumb-separator {
    color: var(--text-muted);
    opacity: 0.5;
}
.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* --- Toggle switch --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: var(--transition-slow);
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-slow);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
input:checked + .toggle-slider {
    background-color: var(--primary-600);
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* --- Drag and drop area --- */
.drop-zone {
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-xl);
    padding: 2rem;
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
}
.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-500);
    background-color: var(--primary-50);
}

/* --- TinyMCE container fix --- */
.tox-tinymce {
    border-radius: var(--radius-md) !important;
    border-color: var(--border-default) !important;
}

/* --- Badge styles --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}
.badge-green { background-color: #dcfce7; color: #166534; }
.badge-yellow { background-color: #fef9c3; color: #854d0e; }
.badge-red { background-color: #fee2e2; color: #991b1b; }
.badge-blue { background-color: #dbeafe; color: #1e40af; }
.badge-purple { background-color: #f3e8ff; color: #6b21a8; }
.badge-gray { background-color: #f3f4f6; color: #374151; }

/* --- Table styles --- */
.data-table {
    width: 100%;
}
.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border-light);
    background-color: var(--surface-secondary);
}
.data-table td {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}
.data-table tbody tr {
    transition: background-color var(--transition-fast);
}
.data-table tbody tr:hover {
    background-color: var(--primary-50);
}

/* --- Card component --- */
.card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
}
.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600;
    color: var(--text-primary);
}
.card-body {
    padding: 1.5rem;
}

/* --- Stat card --- */
.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: all var(--transition-base);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.stat-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}
.stat-card--blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stat-card--green::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.stat-card--yellow::before { background: linear-gradient(90deg, #eab308, #facc15); }
.stat-card--purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.stat-card .stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat-card .stat-info {
    margin-left: 1rem;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

/* --- Media grid --- */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.media-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-base);
    cursor: pointer;
}
.media-card:hover {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-card-hover);
}
.media-card .media-preview {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-secondary);
    overflow: hidden;
}
.media-card .media-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}
.media-card .media-info { padding: 0.5rem; }
.media-card .media-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-card .media-size {
    font-size: 0.675rem;
    color: var(--text-muted);
}

/* --- Button System --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    line-height: 1.5;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}
.btn-secondary:hover {
    background: var(--surface-secondary);
    border-color: var(--primary-300);
    color: var(--primary-700);
}
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    transform: translateY(-1px);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--surface-secondary);
    color: var(--primary-600);
}
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.625rem 1.5rem; font-size: 1rem; }

/* --- Form System --- */
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}
.form-helper {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition-base);
}
.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--primary-300);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}
.pagination a:hover {
    background: var(--primary-50);
    color: var(--primary-600);
}
.pagination .active {
    background: var(--primary-600);
    color: white;
    font-weight: 600;
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}
.empty-state svg {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}
.empty-state p {
    font-size: 0.875rem;
}

/* --- CSS-Only Overrides for existing Tailwind classes --- */

/* Primary buttons -> gradient + shadow */
.bg-primary-600.text-white {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700)) !important;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
    transition: all var(--transition-base);
}
.bg-primary-600.text-white:hover {
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

/* Red buttons -> gradient */
.bg-red-600.text-white {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
    transition: all var(--transition-base);
}
.bg-red-600.text-white:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

/* Card containers - improved */
.bg-white.rounded-xl.shadow-sm {
    box-shadow: var(--shadow-card);
    border-color: var(--border-light);
    transition: box-shadow var(--transition-base);
}
.bg-white.rounded-xl.shadow-sm:hover {
    box-shadow: var(--shadow-card-hover);
}

/* Table rows hover */
table tbody tr {
    transition: background-color var(--transition-fast);
}

/* Input/Select/Textarea improved focus */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
select,
textarea {
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.fade-in { animation: fadeIn 0.3s ease-out; }
.slide-up { animation: slideUp 0.4s ease-out; }
.scale-in { animation: scaleIn 0.2s ease-out; }
