/* ============================================
   Modern Professional Admin Dashboard CSS
   Mobile-First Responsive Design
   ============================================ */

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

#app {
    height: 100%;
}

/* ===== Page Layout ===== */
.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f8f9fa;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - 70px);
}

/* ===== Top Bar ===== */
.top-row {
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    justify-content: flex-end;
    min-height: 70px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    gap: 1rem;
}

/* Mobil Sidebar Toggle Butonu */
.mobile-sidebar-toggle {
    display: none !important;
    background: #0d6efd !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 0.625rem 1rem !important;
    color: #ffffff !important;
    font-size: 1.25rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    min-width: 44px !important;
    min-height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2) !important;
    flex-shrink: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.mobile-sidebar-toggle:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.mobile-sidebar-toggle:active {
    transform: translateY(0);
}

.mobile-sidebar-toggle .toggle-icon {
    display: block;
    line-height: 1;
}

.top-row .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.top-row .user-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #495057;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.top-row .user-name:hover {
    background: #f8f9fa;
    color: #0d6efd;
    transform: translateY(-1px);
}

.top-row .user-icon {
    font-size: 1.1rem;
}

.top-row .logout-btn {
    color: #dc3545;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border: none;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.top-row .logout-btn:hover {
    background: #fff5f5;
    color: #c82333;
}

.top-row .auth-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== Content Area ===== */
.content {
    padding: 1.5rem;
    flex: 1;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== Responsive Design ===== */

/* Mobile First - Base Styles (up to 640px) */
@media screen and (max-width: 640.98px) {
    .page {
        flex-direction: column;
    }

    .mobile-sidebar-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 101 !important;
    }

    .top-row {
        padding: 0.75rem 1rem;
        min-height: 60px;
        justify-content: space-between;
        flex-wrap: wrap;
        z-index: 100;
    }

    .top-row .user-info {
        gap: 0.5rem;
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }

    .top-row .user-name,
    .top-row .logout-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }

    .content {
        padding: 1rem;
    }

    /* Mobilde sidebar overlay için body scroll'u engelle */
    body.sidebar-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Overlay kapalıyken sayfaya tıklanabilir olmalı */
    body:not(.sidebar-open) .sidebar-overlay {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* Tablet (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .mobile-sidebar-toggle {
        display: none !important;
        visibility: hidden !important;
    }

    .content {
        padding: 1.5rem 2rem;
    }

    .top-row {
        padding: 1rem 2rem;
    }
}

/* Desktop (1025px+) */
@media (min-width: 1025px) {
    .mobile-sidebar-toggle {
        display: none !important;
        visibility: hidden !important;
    }

    .page {
        flex-direction: row;
    }

    .top-row {
        padding: 1rem 2.5rem;
    }

    .content {
        padding: 2rem 2.5rem;
        max-width: calc(100vw - 280px);
    }
}

/* ===== Cards ===== */
.card {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: #212529;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Tables ===== */
.table {
    width: 100%;
    margin-bottom: 0;
    color: #212529;
    border-collapse: separate;
    border-spacing: 0;
}

.table th,
.table td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640.98px) {
    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        padding: 0.5rem;
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem;
        border: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .table tbody td:last-child {
        border-bottom: none;
    }

    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        margin-right: 1rem;
    }
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    touch-action: manipulation;
    min-height: 44px; /* Touch-friendly */
}

.btn:focus {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #084298 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

.btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
    background: transparent;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.btn-link {
    color: #0d6efd;
    text-decoration: none;
    background: transparent;
    border: none;
    padding: 0.5rem;
}

.btn-link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

/* ===== Forms ===== */
.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
    font-size: 0.9375rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    min-height: 44px; /* Touch-friendly */
}

.form-control:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.form-control::placeholder {
    color: #6c757d;
    opacity: 1;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bg-success { background-color: #198754 !important; color: #fff !important; }
.bg-danger { background-color: #dc3545 !important; color: #fff !important; }
.bg-warning { background-color: #ffc107 !important; color: #000 !important; }
.bg-info { background-color: #0dcaf0 !important; color: #000 !important; }
.bg-secondary { background-color: #6c757d !important; color: #fff !important; }

/* ===== Text Utilities ===== */
.text-danger { color: #dc3545 !important; }
.text-muted { color: #6c757d !important; }
.text-primary { color: #0d6efd !important; }
.text-success { color: #198754 !important; }
.text-info { color: #0dcaf0 !important; }
.text-warning { color: #ffc107 !important; }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.page-item {
    margin: 0;
}

.page-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d6efd;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    min-width: 44px;
    min-height: 44px;
    transition: all 0.2s ease;
}

.page-link:hover {
    color: #0a58ca;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* ===== Error UI ===== */
#blazor-error-ui {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    border-top: 3px solid #ffc107;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #856404;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#blazor-error-ui .dismiss:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHZpZXdCb3g9IjAgMCA1NiA0OSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEzLjUgMTQuNUwzMCAyOC41TDQ2LjUgMTQuNSIgc3Ryb2tlPSIjRkZGRkZGIiBzdHJva2Utd2lkdGg9IjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8L3N2Zz4K) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: 8px;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ===== Loading States ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(13, 110, 253, 0.3);
    border-radius: 50%;
    border-top-color: #0d6efd;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Utilities ===== */
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !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; }
.mb-5 { margin-bottom: 3rem !important; }

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }

.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-md-none { display: none !important; }
.d-md-flex { display: flex !important; }

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-flex { display: flex !important; }
}

.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
