/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    margin-bottom: 100px;
}

/* Title Section */
.title-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 15px;
    color: white;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.title-logo {
    flex: 0 0 auto;
    width: 96px;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.main-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 0;
    line-height: 1.2;
}

/* Header Section */
.header-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 5px solid #007bff;
}

.header-title {
    font-size: 1.8rem;
    color: #2c3e50;
    font-weight: 600;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 1.1rem;
}

#searchInput {
    width: 100%;
    padding: 15px 50px 15px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

#searchInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.search-info {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* Add Fish Button */
.add-fish-btn {
    padding: 15px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.add-fish-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Table Section */
.table-section {
    margin-bottom: 30px;
}

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.fish-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    min-width: 600px;
}

.fish-table th {
    background: #1a365d;
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.fish-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}

.fish-table tbody tr:hover {
    background-color: #f8f9fa;
}

.fish-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.col-id {
    width: 35px;
    text-align: center;
}

.col-scientific {
    width: 35%;
    font-style: italic;
    color: #5a6c7d;
}

.col-common {
    width: 35%;
    font-weight: normal;
    color: #2c3e50;
}

.col-actions {
    width: 15%;
    text-align: center;
}

/* Pagination Section */
.pagination-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
}

.pagination-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 800px;
    gap: 20px;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
}

.pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 0.9rem;
}

.page-size-select {
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    background: white;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-size-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    padding: 8px 16px;
    border: 2px solid #007bff;
    background: white;
    color: #007bff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-btn:hover:not(:disabled) {
    background: #007bff;
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
    color: #ccc;
}

.page-numbers {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.page-number {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.page-number:hover {
    background: #f0f0f0;
}

.page-number.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Error and No Results Messages */
.error-message, .no-results {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 20px 0;
}

.error-message {
    color: #dc3545;
    border-left: 5px solid #dc3545;
}

.no-results {
    color: #666;
}

.no-results h3 {
    margin: 15px 0 10px;
    color: #333;
}

.link-btn {
    background: none;
    border: none;
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
}

.link-btn:hover {
    color: #0056b3;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.footer-content p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 10px;
    }
    
    .main-title {
        font-size: 1.8rem;
    }
    
    .header-title {
        font-size: 1.4rem;
    }
    
    .title-section {
        padding: 20px 15px;
    }

    .title-row {
        flex-direction: column;
        gap: 10px;
    }

    .title-logo {
        width: 140px;
        max-width: 70%;
    }
    
    .search-box {
        margin-bottom: 10px;
    }
    
    .search-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .add-fish-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }
    
    #searchInput {
        padding: 12px 40px 12px 40px;
        font-size: 0.9rem;
    }
    
    .fish-table th,
    .fish-table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
    
    .col-id {
        width: 30px;
    }
    
    .pagination-controls {
        gap: 5px;
    }
    
    .pagination-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .page-number {
        padding: 6px 8px;
        min-width: 35px;
        font-size: 0.8rem;
    }
    
    .footer {
        position: relative;
        margin-top: 40px;
    }
    
    body {
        padding-bottom: 0;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: none;
        margin: 0;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .add-fish-form {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.5rem;
    }
    
    .header-title {
        font-size: 1.2rem;
    }
    
    .container {
        margin: 5px;
        padding: 10px;
    }
    
    .title-section {
        padding: 15px 10px;
    }
    
    .table-container {
        border-radius: 5px;
    }
    
    .fish-table {
        min-width: 500px;
    }
    
    .action-btn {
        padding: 4px 6px;
        font-size: 0.7rem;
        min-width: 25px;
    }
    
    .action-buttons {
        gap: 4px;
    }
    
    .fish-table th,
    .fish-table td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .col-id {
        width: 25px;
    }
    
    .pagination-section {
        gap: 15px;
    }
    
    .pagination-top {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .pagination-info {
        order: 2;
    }
    
    .pagination-size {
        order: 1;
    }
    
    .pagination-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .page-numbers {
        order: -1;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fish-table th {
        background: #000;
        color: #fff;
    }
    
    .fish-table tbody tr:hover {
        background-color: #f0f0f0;
    }
    
    .pagination-btn {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
        border: 4px solid #007bff;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 2001;
}

.modal-header {
    padding: 25px 30px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Form Styles */
.add-fish-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.required {
    color: #dc3545;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input:invalid {
    border-color: #dc3545;
}

.form-help {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #dee2e6;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid #28a745;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.action-btn {
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
}

.edit-btn {
    background: #ffc107;
    color: #212529;
}

.edit-btn:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4);
}

/* Delete Modal Specific Styles */
.delete-modal {
    max-width: 450px;
}

.delete-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.delete-content {
    padding: 30px;
}

.delete-fish-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #dc3545;
}

.delete-warning {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 15px;
}