/* ============================================
   MikroTik Manager - Ana Stil Dosyası
   Dark Mode + Responsive
   ============================================ */

/* ---- CSS Değişkenleri ---- */
:root {
    --sidebar-width: 256px;
    --navbar-height: 64px;
}

/* ---- Dark Mode ---- */
html.dark {
    color-scheme: dark;
}

/* ---- Genel Layout ---- */
.main-content {
    margin-top: var(--navbar-height);
    margin-left: 0;
    min-height: calc(100vh - var(--navbar-height));
    transition: margin-left 0.2s ease;
}

@media (min-width: 1024px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

/* ---- Sidebar ---- */
.sidebar {
    overflow-y: auto;
    scrollbar-width: thin;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 4px;
}

/* ---- Arama Dropdown ---- */
.search-dropdown {
    scrollbar-width: thin;
}

.search-dropdown .search-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.search-dropdown .search-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

/* ---- İstatistik Kartları ---- */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ---- Cihaz Kartları ---- */
.device-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ---- Status Badge ---- */
.status-online {
    background-color: #dcfce7;
    color: #16a34a;
}

.dark .status-online {
    background-color: rgba(22, 163, 74, 0.2);
    color: #4ade80;
}

.status-offline {
    background-color: #fef2f2;
    color: #dc2626;
}

.dark .status-offline {
    background-color: rgba(220, 38, 38, 0.2);
    color: #f87171;
}

/* ---- Pulse Animasyonu (online göstergesi) ---- */
.pulse-online {
    position: relative;
}

.pulse-online::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0; transform: translate(-50%, -50%) scale(2); }
}

/* ---- Tablo Stilleri ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}

.dark .data-table th {
    color: #9ca3af;
    border-bottom-color: #374151;
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f3f4f6;
}

.dark .data-table td {
    border-bottom-color: #1f2937;
}

.data-table tbody tr {
    transition: background-color 0.15s;
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

.dark .data-table tbody tr:hover {
    background-color: rgba(55, 65, 81, 0.5);
}

/* ---- Modal ---- */
.modal {
    animation: fadeIn 0.2s ease;
}

.modal > div {
    animation: slideUp 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Alert Stilleri ---- */
.alert-success {
    background-color: #dcfce7;
    color: #16a34a;
    border: 1px solid #86efac;
}

.dark .alert-success {
    background-color: rgba(22, 163, 74, 0.15);
    color: #4ade80;
    border-color: rgba(22, 163, 74, 0.3);
}

.alert-error {
    background-color: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.dark .alert-error {
    background-color: rgba(220, 38, 38, 0.15);
    color: #f87171;
    border-color: rgba(220, 38, 38, 0.3);
}

.alert-info {
    background-color: #eff6ff;
    color: #2563eb;
    border: 1px solid #93c5fd;
}

.dark .alert-info {
    background-color: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
    border-color: rgba(37, 99, 235, 0.3);
}

/* ---- Toast Bildirimi ---- */
.toast-container {
    position: fixed;
    top: 80px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 360px;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ---- Progress Bar Renkleri ---- */
.bar-low { background-color: #22c55e; }
.bar-medium { background-color: #eab308; }
.bar-high { background-color: #f97316; }
.bar-critical { background-color: #ef4444; }

/* ---- Skeleton Loading ---- */
.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---- Tab Aktif Stili ---- */
.device-tab.active,
.dhcp-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.dark .device-tab.active,
.dark .dhcp-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

/* ---- Scrollbar Genel ---- */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.3) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

/* ---- Responsive Düzeltmeler ---- */
@media (max-width: 640px) {
    .data-table th,
    .data-table td {
        padding: 8px 12px;
        font-size: 13px;
    }

    .stat-card {
        padding: 16px;
    }
}

/* ---- Bağlantı Testi Sonuç ---- */
.connection-success {
    background-color: #f0fdf4;
    border-color: #86efac;
}

.dark .connection-success {
    background-color: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
}

.connection-error {
    background-color: #fef2f2;
    border-color: #fca5a5;
}

.dark .connection-error {
    background-color: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

/* ---- Select2 Tailwind Uyumlu ---- */

/* Select2 aktifken orijinal select'i gizle */
select.select2-hidden-accessible {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
}

.select2-container {
    display: block !important;
}

.select2-container--default .select2-selection--single {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 36px 0 16px;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: inherit;
    color: #111827;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9ca3af;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    height: auto;
    width: auto;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #6b7280 transparent transparent transparent;
    border-width: 5px 4px 0 4px;
    margin: 0;
    position: static;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 4px;
    font-size: 1.1em;
}

/* Dropdown */
.select2-dropdown {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 4px;
}

.select2-search--dropdown {
    padding: 8px;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 8px 12px;
    font-size: 0.875rem;
    outline: none;
    width: 100%;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.select2-results__option {
    padding: 10px 14px;
    font-size: 0.875rem;
    line-height: 1.25rem;
    transition: background-color 0.1s;
}

.select2-container--default .select2-results__option--selectable:hover {
    background-color: #eff6ff;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #2563eb;
    color: #ffffff;
}

.select2-container--default .select2-results__option--selected {
    background-color: #f0f9ff;
    color: #1e40af;
    font-weight: 500;
}

/* Multiple */
.select2-container--default .select2-selection--multiple {
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    min-height: 44px;
    padding: 4px 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.375rem;
    padding: 2px 8px;
    font-size: 0.8125rem;
    color: #1d4ed8;
    margin: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #3b82f6;
    margin-right: 4px;
}

/* Focus */
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    outline: none;
}

/* ---- Select2 Dark Mode ---- */
.dark .select2-container--default .select2-selection--single {
    background-color: #374151;
    border-color: #4b5563;
}

.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f3f4f6;
}

.dark .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6b7280;
}

.dark .select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #9ca3af transparent transparent transparent;
}

.dark .select2-dropdown {
    background-color: #1f2937;
    border-color: #4b5563;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.dark .select2-search--dropdown .select2-search__field {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark .select2-search--dropdown .select2-search__field:focus {
    border-color: #3b82f6;
}

.dark .select2-results__option {
    color: #e5e7eb;
}

.dark .select2-container--default .select2-results__option--selectable:hover {
    background-color: #374151;
}

.dark .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: #2563eb;
    color: #ffffff;
}

.dark .select2-container--default .select2-results__option--selected {
    background-color: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
}

.dark .select2-container--default .select2-selection--multiple {
    background-color: #374151;
    border-color: #4b5563;
}

.dark .select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #4b5563;
    border-color: #6b7280;
    color: #e5e7eb;
}

.dark .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #9ca3af;
}

.dark .select2-container--default.select2-container--focus .select2-selection--single,
.dark .select2-container--default.select2-container--open .select2-selection--single,
.dark .select2-container--default.select2-container--focus .select2-selection--multiple,
.dark .select2-container--default.select2-container--open .select2-selection--multiple {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
