/* Machine Management Styles */
.machine-management-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
}

.notification-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.notification-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.notification-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-message {
    flex: 1;
    margin-right: 10px;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.notification-close:hover {
    opacity: 1;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: scaleIn 0.2s ease-out;
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6c757d;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: #f8f9fa;
}

.modal-body {
    padding: 16px 24px;
}

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.title-section h1 {
    margin: 0 0 8px 0;
    font-size: 32px;
    font-weight: 700;
    color: #333;
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-section h1 i {
    color: #6366f1;
}

.page-subtitle {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #218838;
    transform: translateY(-1px);
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background-color: #138496;
    transform: translateY(-1px);
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #545b62;
    transform: translateY(-1px);
}

/* Search and Filters */
.filters-section {
    margin-bottom: 24px;
}

.search-container {
    max-width: 400px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #6c757d;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.search-clear:hover {
    background-color: #f8f9fa;
}

/* Form Cards */
.form-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    overflow: hidden;
}

.form-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
}

.form-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #6c757d;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.form-close:hover {
    background-color: #e9ecef;
}

.machine-form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

.form-input, .form-select {
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Machines Section */
.machines-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.section-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.section-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.machines-count {
    font-size: 14px;
    color: #6c757d;
    font-weight: 400;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #6c757d;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #495057;
}

.empty-state p {
    margin: 0;
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

/* Desktop Table */
.machines-table-container {
    overflow-x: auto;
}

.machines-table {
    width: 100%;
    border-collapse: collapse;
}

.machines-table th {
    background-color: #f8f9fa;
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.machines-table th.sortable:hover {
    background-color: #e9ecef;
}

.machines-table th.asc .sort-icon::before {
    content: "\f0de";
}

.machines-table th.desc .sort-icon::before {
    content: "\f0dd";
}

.sort-icon {
    margin-left: 8px;
    opacity: 0.5;
}

.machines-table td {
    padding: 16px 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.machines-table tr:hover {
    background-color: #f8f9fa;
}

.machines-table tr.editing {
    background-color: #fff3cd;
}

.machines-table tr.editing:hover {
    background-color: #ffeaa7;
}

/* Table Cell Styles */
.pcbid-text {
    font-family: monospace;
    font-weight: 600;
    color: #6366f1;
}

.machine-name {
    font-weight: 500;
}

.description-text {
    color: #495057;
}

.arcade-name {
    color: #28a745;
    font-weight: 500;
}

.placeholder-text {
    color: #6c757d;
    font-style: italic;
}

.game-info {
    color: #17a2b8;
    font-weight: 500;
}

.port-text {
    font-family: monospace;
    color: #333;
}

/* Edit Field Styles */
.edit-field {
    min-width: 150px;
}

.edit-field .form-input {
    margin: 0;
    width: 100%;
}

.game-edit-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-extra {
    margin-top: 8px;
}

.arcade-edit-container {
    min-width: 200px;
}

.port-input {
    max-width: 100px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.action-buttons.editing {
    justify-content: flex-start;
}

.action-buttons.disabled {
    opacity: 0.3;
}

.actions-column {
    width: 120px;
    text-align: center;
}

.actions-cell {
    text-align: center;
}

/* Mobile Cards */
.machines-cards {
    padding: 16px;
}

.machine-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.machine-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.machine-card-header {
    padding: 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.machine-id {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pcbid-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
}

.pcbid-value {
    font-family: monospace;
    font-weight: 600;
    color: #6366f1;
    font-size: 14px;
}

.machine-card-body {
    padding: 16px;
}

.machine-field {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.machine-field:last-child {
    border-bottom: none;
}

.machine-field label {
    font-weight: 500;
    color: #495057;
    min-width: 80px;
    margin-right: 12px;
}

.machine-field > span,
.machine-field > div {
    flex: 1;
    text-align: right;
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .machine-management-container {
        padding: 16px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .header-actions {
        justify-content: flex-start;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .machine-management-container {
        padding: 12px;
    }
    
    .title-section h1 {
        font-size: 24px;
    }
    
    .header-actions {
        flex-wrap: wrap;
    }
    
    .notification {
        left: 12px;
        right: 12px;
        min-width: auto;
        max-width: none;
    }
    
    .modal-content {
        margin: 12px;
        width: calc(100% - 24px);
    }
    
    .form-actions {
        justify-content: stretch;
        flex-direction: column;
    }
    
    .search-container {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .machine-management-container {
        padding: 8px;
    }
    
    .page-header {
        margin-bottom: 20px;
    }
    
    .form-card,
    .machines-section {
        border-radius: 8px;
    }
    
    .machine-card-header {
        padding: 12px;
    }
    
    .machine-card-body {
        padding: 12px;
    }
    
    .machine-field {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    
    .machine-field label {
        min-width: auto;
        margin-right: 0;
    }
    
    .machine-field > span,
    .machine-field > div {
        text-align: left;
    }
}

/* Print Styles */
@media print {
    .machine-management-container {
        box-shadow: none;
        border: none;
    }
    
    .notification,
    .modal-overlay,
    .header-actions,
    .form-card,
    .search-container,
    .action-buttons {
        display: none !important;
    }
    
    .machines-table {
        border: 1px solid #333;
    }
    
    .machines-table th,
    .machines-table td {
        border: 1px solid #333;
        padding: 8px;
    }
}
