:root {
    /* Color Palette */
    --primary: #6B4EFF;
    --primary-light: #ECE9FF;
    --secondary: #FF8F6B;
    --bg-body: #F5F6FA;
    --bg-card: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;

    /* Spacing & Radius */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --header-height: 80px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* Layout Structure */
.app-container {
    display: flex;
    width: 100%;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    padding-top: calc(var(--header-height) + 2rem);
    min-height: 100vh;
}

/* Mobile Sidebar Toggle */
#sidebar-toggle {
    display: none;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.0rem;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 3rem;
    padding-left: 0.5rem;
}

.brand i {
    color: var(--primary);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: var(--bg-body);
    color: var(--primary);
}

.nav-link.active {
    background-color: var(--primary);
    color: white !important;
    box-shadow: 0 4px 12px rgba(107, 78, 255, 0.3);
}

.nav-link i {
    font-size: 1.2rem;
    min-width: 24px;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    /* Semi-transparent white */
    backdrop-filter: blur(8px);
    /* Blur effect */
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 900;
    /* Below sidebar on mobile overlap, but above content */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.search-bar {
    background: var(--bg-card);
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    width: 400px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
    transition: all 0.3s;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-bar input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: var(--text-main);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.icon-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
    border: none;
}

.icon-btn:hover {
    transform: translateY(-2px);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 2px var(--primary);
}

/* Dashboard & Cards */
.hero-card {
    background: linear-gradient(135deg, #8E76FF 0%, #6B4EFF 100%);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px rgba(107, 78, 255, 0.25);
}

.hero-content h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.hero-content p {
    opacity: 0.9;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.btn-hero {
    background: #1F2937;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s;
}

.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Decoration for hero */
.hero-bg-icon {
    position: absolute;
    right: -20px;
    bottom: -40px;
    font-size: 15rem;
    opacity: 0.1;
    transform: rotate(-15deg);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.purple {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.orange {
    background: #FFF4E6;
    color: var(--secondary);
}

.stat-icon.green {
    background: #E6FBF5;
    color: var(--success);
}

.stat-icon.blue {
    background: #E0F2FE;
    color: #0EA5E9;
}

.stat-info h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.stat-info .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.2rem;
}

/* Grid for Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.panel-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
}

.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    border-bottom: 1px solid #F3F4F6;
}

.table tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr:hover {
    background: #F9FAFB;
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: #FAFAFA;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.btn {
    background: var(--primary);
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
}

.btn:hover {
    background: #5538EE;
    box-shadow: 0 4px 10px rgba(107, 78, 255, 0.3);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
}

/* Kişi Ekle Formu */
.contact-add-form {
    display: grid;
    grid-template-columns: 2fr 2fr 2fr auto;
    gap: 0.75rem;
    align-items: end;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        /* Slightly wider for mobile touch */
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
        padding-top: calc(var(--header-height) + 1rem);
        /* Ensure content doesn't hide behind header */
    }

    .top-header {
        left: 0;
        padding: 0 1rem;
        width: 100%;
    }

    #sidebar-toggle {
        display: block;
        font-size: 1.5rem;
        cursor: pointer;
        margin-right: 1rem;
        color: var(--text-main);
    }

    .search-bar {
        display: none;
    }
    
    /* Kişi Ekle Formu Mobil Responsive */
    .contact-add-form {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    .contact-add-form button[type="submit"] {
        width: 100% !important;
        padding: 0.75rem !important;
    }

    /* Dashboard Stats Grid Mobil */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}