:root {
    --primary: #2c7be5;
    --primary-dark: #1a5bb5;
    --success: #00d97e;
    --danger: #e63757;
    --warning: #f6c343;
    --info: #39afd1;
    --dark: #12263f;
    --gray-100: #f9f9fb;
    --gray-200: #edf2f6;
    --gray-300: #d1d9e6;
    --gray-400: #b0bec5;
    --gray-500: #78909c;
    --gray-600: #546e7a;
    --gray-700: #37474f;
    --sidebar-width: 260px;
    --header-height: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Login Page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    text-align: center;
}

.login-card .logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-card .subtitle {
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 14px;
}

.login-card .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-card .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.login-card .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,123,229,0.1);
}

.login-card .btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.login-card .btn-login:hover {
    background: var(--primary-dark);
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .brand {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.sidebar-header .brand span {
    color: var(--primary);
}

.sidebar-nav {
    padding: 16px 0;
}

.sidebar-nav .nav-section {
    padding: 8px 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    margin-top: 8px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: var(--gray-300);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(44,123,229,0.15);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    margin-right: 12px;
    font-size: 18px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.top-bar .user-name {
    font-size: 14px;
    font-weight: 500;
}

.top-bar .user-role {
    font-size: 11px;
    color: var(--gray-500);
}

.content-area {
    padding: 32px;
    flex: 1;
    min-width: 0;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Stats Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    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);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.primary { background: rgba(44,123,229,0.1); color: var(--primary); }
.stat-icon.success { background: rgba(0,217,126,0.1); color: var(--success); }
.stat-icon.warning { background: rgba(246,195,67,0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(230,55,87,0.1); color: var(--danger); }
.stat-icon.info { background: rgba(57,175,209,0.1); color: var(--info); }

.stat-content {
    min-width: 0;
    flex: 1;
}

.stat-content .stat-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-content .stat-label {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

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

table.dataTable thead th {
    background: var(--gray-100);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

table.dataTable tbody td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

table.dataTable tbody tr:hover {
    background: var(--gray-100);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.btn i { font-size: 16px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #00b868; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c92a47; }

.btn-warning { background: var(--warning); color: var(--dark); }
.btn-warning:hover { background: #e0b230; }

.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2d96b8; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-600);
}
.btn-outline:hover { background: var(--gray-100); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    outline: none;
    background: #fff;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,123,229,0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23546e7a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: rgba(0,217,126,0.12); color: #00a36b; }
.badge-danger { background: rgba(230,55,87,0.12); color: #c92a47; }
.badge-warning { background: rgba(246,195,67,0.15); color: #b8860b; }
.badge-info { background: rgba(57,175,209,0.12); color: #2d8da8; }
.badge-primary { background: rgba(44,123,229,0.12); color: var(--primary); }
.badge-secondary { background: var(--gray-200); color: var(--gray-600); }

/* Machine Cards - Üretim Sayfası */
.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.machine-card {
    background: #fff;
    border-radius: 16px;
    border: 2px solid var(--gray-200);
    overflow: hidden;
    transition: all 0.3s;
}

.machine-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.machine-card.active {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(0,217,126,0.15);
}

.machine-card.paused {
    border-color: var(--warning);
    box-shadow: 0 0 0 3px rgba(246,195,67,0.15);
}

.machine-card-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
}

.machine-card-header .machine-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    background: var(--gray-100);
    color: var(--gray-600);
}

.machine-card.active .machine-icon {
    background: rgba(0,217,126,0.1);
    color: var(--success);
}

.machine-card.paused .machine-icon {
    background: rgba(246,195,67,0.1);
    color: var(--warning);
}

.machine-card-header .machine-name {
    font-size: 16px;
    font-weight: 600;
}

.machine-card-header .machine-capacity {
    font-size: 12px;
    color: var(--gray-500);
}

.machine-card-body {
    padding: 20px 24px;
}

.machine-card-body .info-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
}

.machine-card-body .info-row .label {
    color: var(--gray-500);
}

.machine-card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
}

.machine-card-footer .btn {
    flex: 1;
    justify-content: center;
    padding: 10px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-box {
    transform: translateY(0);
}

.select2-dropdown {
    z-index: 2500 !important;
}

.select2-container--open {
    z-index: 2500 !important;
}

.swal2-container {
    z-index: 99999 !important;
}

.modal-box-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-box-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-box-header .close-btn {
    width: 32px; height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
}

.modal-box-body {
    padding: 24px;
}

.modal-box-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .content-area {
        padding: 20px;
    }
    .machine-grid {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* Flash Messages */
.flash-msg {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    animation: slideIn 0.3s, fadeOut 0.3s 2.7s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.flash-msg.success { background: var(--success); }
.flash-msg.error { background: var(--danger); }
.flash-msg.info { background: var(--info); }

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

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

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
}

/* Tab system */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-btn:hover { color: var(--dark); }
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 15px;
}

/* Progress Bar */
.progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}

/* Print styles */
@media print {
    .sidebar, .top-bar, .btn, .card-header .btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
    .content-area { padding: 0 !important; }
    .stat-card { box-shadow: none; border: 1px solid #ddd; }
    body { background: #fff; }
    .chart-container { height: 250px; }
}

/* Timer */
.timer {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--success);
}

.timer.paused {
    color: var(--warning);
}

/* Select2 in Modals */
.select2-container {
    z-index: 3000 !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
    z-index: 3001 !important;
}
.select2-container--bootstrap-5 .select2-selection--single {
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    line-height: normal !important;
}

