/* Links page specific styles - add this to your existing style.css */

/* Page header */
.page-header {
    margin-bottom: 15px;
    padding-top: 5px;
}

.page-header h1 {
    font-size: 36px;
    margin-bottom: 8px;
}

.links-container {
    margin-bottom: 64px;
}

/* Links table container */
.links-table-container {
    background-color: #111;
    padding: 32px;
}

.links-table-container h2 {
    margin-bottom: 24px;
    font-size: 24px;
}

/* Inline add form */
.inline-form-container {
    margin-bottom: 32px;
    background-color: #1a1a1a;
    padding: 20px;
    border-radius: 4px;
}

.inline-add-form .form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-add-form input,
.inline-add-form select {
    padding: 12px;
    background-color: #222;
    border: 1px solid #333;
    color: #fff;
    border-radius: 4px;
    flex: 1;
    min-width: 120px;
}

.inline-add-form input[name="originalUrl"] {
    flex: 3;
    min-width: 250px;
}

.inline-add-form input:focus,
.inline-add-form select:focus {
    outline: none;
    border-color: #45e5c3;
}

.form-toggle {
    margin-top: 12px;
    text-align: right;
}

.form-toggle a {
    color: #45e5c3;
    text-decoration: none;
    font-size: 14px;
}

.form-toggle a:hover {
    text-decoration: underline;
}
/* Table header with controls - Updated to ensure items stay on same line */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: nowrap; /* Prevent wrapping */
}

.table-header h2 {
    margin-bottom: 0; /* Remove bottom margin to prevent spacing issues */
    font-size: 24px;
    white-space: nowrap; /* Prevent wrapping of the title */
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0; /* Prevent the controls from shrinking */
}

.items-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap; /* Prevent wrapping */
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .table-header {
        flex-direction: row; /* Keep as row even on small screens */
        align-items: center;
        gap: 12px;
    }

    .table-header h2 {
        font-size: 20px; /* Slightly smaller font on mobile */
    }

    .items-per-page label {
        font-size: 12px; /* Smaller label on mobile */
    }

    .items-per-page select {
        padding: 4px 6px; /* Smaller padding on mobile */
    }
}

/* Table responsive */
.table-responsive {
    overflow-x: auto;
}

.links-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.links-table th {
    padding: 12px 16px;
    border-bottom: 1px solid #333;
    font-weight: 600;
    color: #aaa;
}

.links-table td {
    padding: 16px;
    border-bottom: 1px solid #222;
}

.links-table tbody tr:hover {
    background-color: #1a1a1a;
}

.short-link {
    color: #45e5c3;
    text-decoration: none;
    font-weight: 500;
}

.original-url {
    max-width: 300px;
}

.truncate-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 12px 24px;
    background-color: transparent;
    border: 1px solid #45e5c3;
    color: #45e5c3;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.button:hover {
    background-color: rgba(69, 229, 195, 0.1);
}

.button-secondary {
    border-color: #555;
    color: #fff;
}

.button-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.button-danger {
    border-color: #e54545;
    color: #e54545;
}

.button-danger:hover {
    background-color: rgba(229, 69, 69, 0.1);
}

.copy-button,
.action-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.copy-button:hover,
.action-button:hover {
    opacity: 1;
}

.actions {
    white-space: nowrap;
}

/* Icons */
.copy-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2345e5c3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1'/%3E%3C/svg%3E") no-repeat center center;
    background-size: contain;
}

.edit-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.828 2.828 0 114 4L7.5 20.5 2 22l1.5-5.5L17 3z'/%3E%3C/svg%3E") no-repeat center center;
    background-size: contain;
}

.delete-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e54545' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E") no-repeat center center;
    background-size: contain;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V9z'/%3E%3Cpolyline points='13 2 13 9 20 9'/%3E%3C/svg%3E") no-repeat center center;
    background-size: contain;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 0;
    color: #777;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #111;
    padding: 32px;
    border-radius: 4px;
    max-width: 500px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 24px;
}

/* Copied feedback */
.copy-button.copied::after {
    content: "Copied!";
    position: absolute;
    background: #45e5c3;
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
    opacity: 1;
    animation: fadeOut 2s forwards;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Tab label two-line clamp for small screens */
.tablabel-2line {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* clamp to 2 lines */
    overflow: hidden;
    word-break: break-word;
}

/* Responsive styles */
@media (max-width: 768px) {
    .inline-add-form .form-row {
        flex-direction: column;
        gap: 12px;
    }

    .inline-add-form input,
    .inline-add-form select {
        width: 100%;
    }

    .advanced-options .form-row {
        flex-direction: column;
    }

    .links-table th:nth-child(3),
    .links-table td:nth-child(3) {
        display: none;
    }
}

@media (max-width: 576px) {
    .links-table th:nth-child(4),
    .links-table td:nth-child(4) {
        display: none;
    }
}