/* 
   Modern App-Like Design System 
   Focus: Mobile-First, Premium UI/UX, Apple-inspired
*/

:root {
    --primary: #007AFF;
    --primary-light: #E5F1FF;
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
    --bg-main: #F2F2F7;
    --bg-card: #FFFFFF;
    --text-main: #1C1C1E;
    --text-muted: #8E8E93;
    --border: rgba(0, 0, 0, 0.08);
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --glass: saturate(180%) blur(20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: calc(80px + var(--safe-bottom)); /* Space for mobile nav */
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Global Ambient Background */
body::before, body::after {
    content: "";
    position: fixed;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    z-index: -2;
    filter: blur(120px);
    pointer-events: none;
    opacity: 0.6;
}

body::before {
    top: -200px;
    right: -200px;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
}

body::after {
    bottom: -200px;
    left: -200px;
    background: radial-gradient(circle, rgba(52, 199, 89, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
}

.ambient-extra {
    position: fixed;
    top: 40%;
    left: 30%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 149, 0, 0.08) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: -2;
    filter: blur(120px);
    pointer-events: none;
    opacity: 0.6;
}

/* Desktop spacing */
@media (min-width: 768px) {
    body {
        padding-bottom: 2rem;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
}

/* App Header */
.header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Bottom Navigation (Mobile Only) */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 12px 0 calc(8px + var(--safe-bottom));
    z-index: 1000;
}

@media (min-width: 768px) {
    .mobile-nav {
        display: none;
    }
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    flex: 1;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

/* App Cards */
.dashboard-content {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 1rem;
}

.apple-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.apple-card:active {
    transform: scale(0.96);
    background-color: var(--bg-main);
}

@media (min-width: 768px) {
    .apple-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--primary);
    }
    .grid-cards {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 24px;
    }
}

/* Badges */
.role-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.role-musteri { background: #E5F1FF; color: #007AFF; }
.role-tedarikci { background: #FFF4E5; color: #FF9500; }
.role-yonetici { background: #FFEBEB; color: #FF3B30; }

/* Tables Responsive (Transform to Cards on Mobile) */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

@media (max-width: 767px) {
    .table thead {
        display: none;
    }
    .table tr {
        display: block;
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    .table td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border: none !important;
        font-size: 0.95rem;
    }
    .table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.85rem;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

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

.card-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -1px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { background: white; color: var(--text-main); border: 1px solid var(--border); }
.btn-outline:active { background: var(--bg-main); }
.btn-block { width: 100%; display: flex; }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-toggle {
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-toggle:active {
    background: #e5e5ea;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    min-width: 180px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    z-index: 1001;
    margin-top: 8px;
    padding: 6px 0;
}

.dropdown.active .dropdown-menu { display: block; }
.dropdown-item {
    display: block;
    padding: 10px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
}
.dropdown-item:hover { background: var(--bg-main); }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}
.form-control:focus { 
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-success { background: #EAF9EE; color: #1E7E34; }
.alert-error { background: #FFEEEE; color: #D63031; }

/* DataTables Custom */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border) !important;
    border-radius: 999px !important;
    padding: 8px 16px !important;
    margin-bottom: 1rem !important;
}
.dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-radius: 999px !important;
    color: white !important;
    border: none !important;
}
