/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.4;
    color: #333;
    background-color: #f5f5f5;
    font-size: 13px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 10px;
}

/* Typography */
h1 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5rem;
    text-align: center;
    font-weight: 600;
}

h2 {
    color: #34495e;
    margin-bottom: 10px;
    font-size: 1.1rem;
    border-bottom: 1px solid #3498db;
    padding-bottom: 5px;
    font-weight: 600;
}

h3 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

h4 {
    color: #34495e;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

p {
    margin-bottom: 15px;
    font-size: 1rem;
    line-height: 1.7;
}

/* Form hints */
small.form-hint {
    display: block;
    margin-top: 8px;
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

/* Batch form styles */
.batch-form {
    margin-bottom: 20px;
}

/* Switch toggle styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3498db;
}

input:focus + .slider {
    box-shadow: 0 0 1px #3498db;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Small button styles */
.btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
    line-height: 1.4;
    border-radius: 3px;
    margin-right: 5px;
    border: 1px solid #ddd;
    background-color: #fff;
    cursor: pointer;
}

.btn-sm:hover {
    background-color: #f8f9fa;
}

.btn-primary.btn-sm {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.btn-primary.btn-sm:hover {
    background-color: #0056b3;
}

.btn-danger.btn-sm {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger.btn-sm:hover {
    background-color: #c82333;
}

.btn-secondary.btn-sm {
    background-color: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-secondary.btn-sm:hover {
    background-color: #5a6268;
}

/* Compact form styles */
.compact-form {
    margin-bottom: 10px;
    padding: 10px;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.compact-form .form-row {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 5px;
}

.compact-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 120px;
}

.compact-form label {
    font-size: 0.8rem;
    margin-bottom: 3px;
    font-weight: 500;
}

.compact-form input {
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    width: 100%;
}

/* Search section styles */
.search-section {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    padding: 10px;
    margin-bottom: 10px;
}

.search-section h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: #2c3e50;
}

.search-form, .batch-delete {
    margin-bottom: 10px;
}

.search-form:last-child, .batch-delete:last-child {
    margin-bottom: 0;
}

.search-form .form-row, .batch-delete .form-row {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.search-form .form-group, .batch-delete .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 100px;
}

.search-form label, .batch-delete label {
    font-size: 0.8rem;
    margin-bottom: 3px;
    font-weight: 500;
}

.search-form input, .batch-delete input {
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    width: 100%;
}

/* Combined section styles */
.combined-section {
    margin-bottom: 10px;
}

.combined-row {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.combined-col {
    flex: 1;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    padding: 10px;
}

.batch-delete-section {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    padding: 10px;
}

/* Links table section */
.links-table-section {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    padding: 10px;
    overflow: auto;
}

/* Compact table styles */
.compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    background-color: #fff;
}

.compact-table th,
.compact-table td {
    padding: 4px 6px;
    text-align: left;
    border: 1px solid #e9ecef;
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
    max-width: 150px;
}

.compact-table th {
    white-space: nowrap;
    max-width: 120px;
    background-color: #3498db;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.2px;
    text-align: center;
}

.compact-table td {
    font-size: 0.75rem;
}

.compact-table a {
    font-size: 0.7rem;
    color: #007bff;
    text-decoration: none;
    word-break: break-all;
}

.compact-table a:hover {
    text-decoration: underline;
}

/* Main link row styles */
.main-link-row {
    background-color: #f8f9fa;
}

/* Add target row styles */
.add-target-row td {
    text-align: center;
    background-color: #f8f9fa;
}

/* Target link form styles */
.target-link-form {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.target-link-form h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

.target-link-form .form-row {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.target-link-form .form-group {
    margin-bottom: 8px;
    flex: 1;
    min-width: 120px;
}

.target-link-form label {
    font-size: 0.8rem;
    margin-bottom: 3px;
    font-weight: 500;
}

.target-link-form input, .target-link-form select {
    padding: 4px 6px;
    font-size: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    width: 100%;
}

/* Center align specific columns */
.compact-table td:nth-child(3),
.compact-table td:nth-child(4),
.compact-table td:nth-child(7),
.compact-table td:nth-child(8),
.compact-table td:nth-child(9) {
    text-align: center;
}

/* Form section styles */
.form-section {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.form-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* Smaller headings */
h1 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
}



/* Links */
a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Code */
code {
    background-color: #ecf0f1;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
}

/* Forms */
form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

input[type="text"],
input[type="url"],
input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    text-decoration: none;
}

.btn-secondary {
    background-color: #27ae60;
    color: white;
}

.btn-secondary:hover {
    background-color: #229954;
    text-decoration: none;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    text-decoration: none;
}

/* Layout Sections */
.form-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.links-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Main Links List */
.main-links-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.main-link-item {
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    padding: 20px;
    background-color: #fafafa;
}

.main-link-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.main-link-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat {
    background-color: #ecf0f1;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
}

.main-link-url {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #ecf0f1;
    border-radius: 4px;
    font-size: 0.95rem;
}

/* Add Target Form */
.add-target-form {
    background-color: white;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-bottom: 20px;
}

/* Target Links Table */
.target-links-list {
    margin-bottom: 20px;
}

.target-links-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.target-links-table th,
.target-links-table td {
    padding: 14px 18px;
    text-align: left;
    font-size: 0.95rem;
}

.target-links-table th {
    background-color: #3498db;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: none;
    text-align: center;
}

.target-links-table td {
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.target-links-table tr:last-child td {
    border-bottom: none;
}

.target-links-table tr {
    transition: background-color 0.2s ease;
}

.target-links-table tr:hover {
    background-color: #f8f9fa;
}

.target-links-table tr:nth-child(even) {
    background-color: #fafbfc;
}

.target-links-table tr:nth-child(even):hover {
    background-color: #f1f3f4;
}

.target-links-table a {
    word-break: break-all;
    font-size: 0.9rem;
}

/* Center align specific columns */
.target-links-table td:nth-child(2),
.target-links-table td:nth-child(3),
.target-links-table td:nth-child(4),
.target-links-table td:nth-child(5) {
    text-align: center;
}

/* Improve button styling in table */
.target-links-table .btn {
    font-size: 0.85rem;
    padding: 8px 16px;
    font-weight: 500;
}

/* Improve table header styling */
.target-links-table th:nth-child(1) {
    text-align: left;
    min-width: 300px;
}

/* Responsive table improvements */
@media (max-width: 768px) {
    .target-links-table {
        font-size: 0.85rem;
    }
    
    .target-links-table th,
    .target-links-table td {
        padding: 10px 12px;
    }
    
    .target-links-table th:nth-child(1) {
        min-width: 200px;
    }
}

/* Delete Sections */
.delete-main-link {
    text-align: right;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

/* Empty States */
.no-main-links,
.no-targets {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .form-section,
    .links-section {
        padding: 20px;
    }
    
    .main-link-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .main-link-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-row .form-group {
        width: 100%;
    }
    
    .target-links-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .btn {
        width: 100%;
    }
}