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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #2c3e50;
}

.container-fluid {
    padding: 0;
    max-width: 100%;
}

.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.navbar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-refresh {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.refresh-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.btn-refresh:hover .refresh-icon {
    transform: rotate(180deg);
}

.btn-admin {
    background: rgba(155, 89, 182, 0.1);
    color: #9b59b6;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-admin:hover {
    background: rgba(155, 89, 182, 0.2);
    color: #8e44ad;
}

.btn-logout {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

.main-content {
    padding: 2rem;
    max-width: 95%;
    margin: 0 auto;
}

.alerts {
    margin-bottom: 2rem;
}

.alert {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
    border-left-color: #27ae60;
}

.alert-error {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border-left-color: #e74c3c;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #7f8c8d;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #34495e;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

.form-control:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-primary {
    width: 100%;
    background: #3498db;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.login-info {
    text-align: center;
    margin-top: 1.5rem;
}

.login-info small {
    color: #7f8c8d;
}

.analytics-dashboard {
    animation: fadeIn 0.6s ease;
}

.dashboard {
    animation: fadeIn 0.6s ease;
}

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

.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.warning {
    border-left: 4px solid #f39c12;
}

.stat-card.success {
    border-left: 4px solid #27ae60;
}

.stat-card.danger {
    border-left: 4px solid #e74c3c;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 500;
}

.data-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
}

.section-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.count-badge {
    background: #3498db;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.terminals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.terminal-card {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.terminal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.terminal-card.zero-sales {
    border-left: 4px solid #e74c3c;
}

.terminal-card.active-sales {
    border-left: 4px solid #27ae60;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.terminal-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.terminal-id {
    font-size: 0.8rem;
    color: #7f8c8d;
    background: #ecf0f1;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.terminal-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.stat-row.total {
    font-weight: 600;
    padding-top: 0.5rem;
    border-top: 1px solid #ecf0f1;
    color: #2c3e50;
}

.amount {
    font-weight: 600;
    color: #27ae60;
}

.count {
    font-weight: 600;
    color: #3498db;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ecf0f1;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #7f8c8d;
    font-weight: 500;
}

.filters-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: #34495e;
    font-size: 0.9rem;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.transactions-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.search-controls {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.search-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.search-select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    min-width: 180px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.btn-clear {
    padding: 0.5rem 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.btn-clear:hover {
    background: #5a6268;
}

.search-stats {
    font-size: 0.9rem;
    color: #6c757d;
}

.table-row-hidden {
    display: none !important;
}

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
    border-radius: 8px;
    border: 1px solid #ecf0f1;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.9rem;
}

.transactions-table th {
    background: #f8f9fa;
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid #e9ecef;
    color: #495057;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.transactions-table th:hover {
    background: #e9ecef;
}

.transactions-table th.sortable::after {
    content: '↕';
    position: absolute;
    right: 8px;
    opacity: 0.5;
    font-size: 0.8rem;
}

.transactions-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #007bff;
}

.transactions-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #007bff;
}

.transactions-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: middle;
}

.transactions-table tr:hover {
    background: rgba(52, 152, 219, 0.05);
}

.transactions-table .terminal-id {
    font-weight: 600;
    color: #2c3e50;
}

.transactions-table .terminal-comment {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transactions-table .amount {
    font-weight: 600;
    text-align: right;
}

.transactions-table .amount.success {
    color: #27ae60;
}

.transactions-table .amount.warning {
    color: #f39c12;
}

.transactions-table .amount.danger {
    color: #e74c3c;
}

.transactions-table .count {
    text-align: center;
    font-weight: 500;
    color: #7f8c8d;
}

.transactions-table .empty-state {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}

.transactions-table .empty-state p {
    margin: 0;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .navbar {
        padding: 1rem;
    }
    
    .navbar-brand h1 {
        font-size: 1.2rem;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .terminals-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .filters-form {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
    }
    
    .transactions-table {
        font-size: 0.8rem;
    }
    
    .transactions-table th,
    .transactions-table td {
        padding: 0.5rem 0.25rem;
    }
    
    .search-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .search-select,
    .search-input,
    .btn-clear {
        width: 100%;
        min-width: unset;
    }
    
    .search-controls {
        padding: 0.75rem;
    }
    
    .search-stats {
        text-align: center;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .search-select,
    .search-input,
    .btn-clear {
        font-size: 16px; /* Предотвращает зум на iOS */
        padding: 0.75rem;
    }
    
    .search-controls {
        margin-bottom: 1rem;
        padding: 0.5rem;
    }
    
    .transactions-section {
        padding: 1rem;
    }
}

/* Админ панель */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.page-header h1 {
    margin: 0;
    color: #2c3e50;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.change-password-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 120px;
    gap: 1rem;
    align-items: end;
}

.add-user-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 120px 2fr 120px;
    gap: 1rem;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
}

.form-control {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.admin-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.admin-table tr:hover {
    background: rgba(52, 152, 219, 0.05);
}

.user-inactive {
    opacity: 0.6;
}

.username {
    font-weight: 600;
}

.role-badge,
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: #e74c3c;
    color: white;
}

.role-user {
    background: #3498db;
    color: white;
}

.status-active,
.status-success {
    background: #27ae60;
    color: white;
}

.status-inactive,
.status-failed {
    background: #e74c3c;
    color: white;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.text-muted {
    color: #6c757d;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .change-password-form .form-row,
    .add-user-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-table {
        font-size: 0.8rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.5rem 0.25rem;
    }
}
