/* Database Editor Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0ea5e9;
    --light-bg: #f8fafc;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* General Layout */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    padding-bottom: 20px;
}

.container-fluid {
    padding: 10px 2rem;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%) !important;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

header h1 {
    display: flex;
    align-items: center;
}

/* Tab Styles */
.nav-tabs {
    border-bottom: none;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 15px;
}

.nav-tabs .nav-link {
    color: var(--secondary-color);
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    margin: 0 0.25rem;
}

.nav-tabs .nav-link:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, var(--info-color) 0%, #0284c7 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.nav-tabs .nav-link i {
    margin-right: 0.5rem;
}

/* Card Styles */
.card {
    box-shadow: var(--card-shadow);
    border: none;
    border-radius: 15px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

.card-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #475569 100%);
    border-bottom: none;
    padding: 1rem 1.25rem;
    color: white;
}

.card-header h5 {
    color: white;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Table Styles */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table {
    margin-bottom: 0;
    background: white;
}

/* Stamps table specific column widths */
#stamps tbody td:nth-child(1) { width: 3%; }  /* ID */
#stamps tbody td:nth-child(2) { width: 5%; }  /* Position */
#stamps tbody td:nth-child(3) { width: 6%; }  /* Designator */
#stamps tbody td:nth-child(4) { width: 10%; } /* Stamp Name */
#stamps tbody td:nth-child(5) { width: 15%; max-width: 180px; } /* Stamp Features */
#stamps tbody td:nth-child(6) { width: 15%; max-width: 180px; } /* Pin Info */
#stamps tbody td:nth-child(7) { width: 25%; max-width: 350px; } /* Remarks */
#stamps tbody td:nth-child(8) { width: 6%; }  /* Developed */
#stamps tbody td:nth-child(9) { width: 6%; }  /* Production */
#stamps tbody td:nth-child(10) { width: 9%; } /* Actions */

/* Apply same widths to header cells */
#stamps thead th:nth-child(1) { width: 3%; }
#stamps thead th:nth-child(2) { width: 5%; }
#stamps thead th:nth-child(3) { width: 6%; }
#stamps thead th:nth-child(4) { width: 10%; }
#stamps thead th:nth-child(5) { width: 15%; }
#stamps thead th:nth-child(6) { width: 15%; }
#stamps thead th:nth-child(7) { width: 25%; }
#stamps thead th:nth-child(8) { width: 6%; }
#stamps thead th:nth-child(9) { width: 6%; }
#stamps thead th:nth-child(10) { width: 9%; }

.table thead th {
    background: linear-gradient(135deg, var(--info-color) 0%, #0284c7 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border: none;
    padding: 12px;
}

.table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

.table tbody tr:hover {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 50%);
}

.table tbody tr:last-child {
    border-bottom: none;
}

.table tbody td {
    vertical-align: middle;
    padding: 0.75rem;
    color: #475569;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.table-sm tbody td {
    padding: 0.5rem;
}

/* Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn i {
    font-size: 0.875rem;
}

.btn-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #78350f;
    font-weight: 600;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #78350f;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.btn-light {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--secondary-color);
}

.btn-light:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #475569 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: 15px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

/* Wider edit modal for stamp editing */
#editModal .modal-dialog {
    max-width: 900px;
}

.modal-header {
    background: linear-gradient(135deg, var(--info-color) 0%, #0284c7 100%);
    border-bottom: none;
    padding: 1.25rem;
    color: white;
}

.modal-title {
    color: white;
    font-weight: 600;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-body {
    padding: 1.5rem;
    background: white;
}

.modal-footer {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
}

/* Form Styles */
.form-label {
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--info-color);
    box-shadow: 0 0 0 0.25rem rgba(14, 165, 233, 0.25);
    background: white;
}

.form-control-sm,
.form-select-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 6px;
}

/* Two-column form layout for edit modals */
.form-group-row {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.form-group-row .form-label {
    flex: 0 0 150px;
    margin-bottom: 0;
    text-align: right;
    padding-right: 0.5rem;
}

.form-group-row .form-input-wrapper {
    flex: 1;
}

.form-group-row .form-control,
.form-group-row .form-select {
    width: 100%;
}

.form-group-row .form-check {
    margin-bottom: 0;
}

/* Special styling for remarks field to make it larger */
.form-group-row.remarks-row {
    align-items: flex-start;
}

.form-group-row.remarks-row .form-label {
    padding-top: 0.5rem;
}

.form-group-row.remarks-row textarea {
    min-height: 120px;
}

/* Filter Section */
.row.mb-3 .col-md-2,
.row.mb-3 .col-md-3,
.row.mb-3 .col-md-1 {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.row.mb-3 {
    align-items: flex-end;
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-left: 4px solid var(--info-color);
}

/* Action Buttons in Table */
.table tbody td:last-child {
    white-space: nowrap;
}

.table tbody td:last-child .btn {
    margin-right: 0.25rem;
}

.table tbody td:last-child .btn:last-child {
    margin-right: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table {
        font-size: 0.875rem;
    }

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

    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #adb5bd;
}

.empty-state p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* Badge Styles for IDs */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Scrollbar Styles */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.card {
    animation: fadeIn 0.4s ease-out;
}

.nav-tabs {
    animation: slideInUp 0.3s ease-out;
}

.table tbody tr {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: slideInUp 0.3s ease-out;
}

/* Utility Classes */
.text-muted {
    color: #6c757d !important;
}

.fw-bold {
    font-weight: 600 !important;
}

/* Expandable Text */
.expandable-text {
    max-width: 150px !important;
    word-wrap: break-word;
    white-space: normal !important;
}

.expandable-text .text-preview,
.expandable-text .text-full {
    max-width: 150px !important;
    white-space: pre-wrap !important;
}

/* Wider expandable text for remarks column */
.expandable-text-wide {
    max-width: 400px !important;
    word-wrap: break-word;
    white-space: normal !important;
}

.expandable-text-wide .text-preview,
.expandable-text-wide .text-full {
    max-width: 400px !important;
    white-space: pre-wrap !important;
}

.expandable-text .toggle-text,
.expandable-text-wide .toggle-text {
    color: var(--info-color);
    text-decoration: none;
    margin-top: 0.25rem;
    display: inline-block;
}

.expandable-text .toggle-text:hover,
.expandable-text-wide .toggle-text:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.expandable-text .toggle-text i,
.expandable-text-wide .toggle-text i {
    font-size: 0.7rem;
}

/* Table Row Hover Effect */
.table tbody tr {
    cursor: default;
}

/* Modal Transition */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
}

/* Success/Error Feedback */
.is-invalid {
    border-color: #dc3545 !important;
}

.is-valid {
    border-color: #198754 !important;
}

.invalid-feedback,
.valid-feedback {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

.invalid-feedback {
    color: #dc3545;
}

.valid-feedback {
    color: #198754;
}

/* Very light placeholder text color */
input::placeholder,
textarea::placeholder {
    color: #d1d5db !important;
    opacity: 1 !important;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: #d1d5db !important;
    opacity: 1 !important;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
    color: #d1d5db !important;
    opacity: 1 !important;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
    color: #d1d5db !important;
    opacity: 1 !important;
}
