* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    color: #333;
}

/* Navigation Header */
.nav-header {
    background: #ffffff;
    border-bottom: 1px solid #e1e5e9;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-container {
    width: 100%;
    max-width: none;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.nav-left h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

.nav-center {
    flex: 1;
    max-width: 700px;
}

.create-form-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.create-form-inline label {
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    margin: 0;
}

.create-form-inline input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: 14px;
    min-width: 250px;
}

.create-form-inline input:focus {
    outline: none;
    border-color: #374151;
    box-shadow: 0 0 0 2px rgba(55, 65, 81, 0.1);
}

.create-form-inline button {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    background: #374151;
    color: white;
    border: 1px solid #374151;
}

.create-form-inline button:hover {
    background: #1f2937;
    border-color: #1f2937;
}

.container {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

main {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.result {
    margin: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #28a745;
}

.result h3 {
    color: #28a745;
    margin-bottom: 10px;
}

section {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

section:last-child {
    border-bottom: none;
}

h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

input[type="email"],
input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

input[type="email"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.9rem;
}

button {
    background: #374151;
    color: white;
    border: 1px solid #374151;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover {
    background: #1f2937;
    border-color: #1f2937;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}


.tracking-url {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tracking-url input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
}

.copy-btn {
    padding: 8px 16px;
    font-size: 14px;
    background: #059669;
    border: 1px solid #059669;
}

.copy-btn:hover {
    background: #047857;
    border-color: #047857;
}

.hidden {
    display: none;
}

.hidden-form {
    display: none;
}

/* File Header and Controls */
.file-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.file-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

#fileTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

#fileTable th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e1e8ed;
}

#fileTable td {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

#fileTable tbody tr:hover {
    background: #f8f9fa;
}

#fileTable tbody tr:last-child td {
    border-bottom: none;
}

.filename-cell {
    font-weight: 500;
    color: #2c3e50;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.url-link {
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
}

.url-link:hover {
    text-decoration: underline;
}

.actions-cell {
    text-align: center;
}

.copy-url-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: #059669;
    color: white;
    border: 1px solid #059669;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.copy-url-btn:hover {
    background: #047857;
    border-color: #047857;
}

/* File Stats */
.file-stats {
    margin-top: 10px;
    text-align: right;
    font-size: 13px;
    color: #666;
}

/* Progress Indicator */
.progress-indicator {
    background: #e6f7ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 12px 20px;
    margin: 15px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #0066cc;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.1);
    animation: fadeIn 0.3s ease;
}

.progress-indicator.hidden {
    display: none;
}

/* Highlight effect for new row */
.highlight-row {
    background: #fff3cd !important;
    border-left: 3px solid #ffc107;
    animation: highlightPulse 2s ease-in-out;
}

@keyframes highlightPulse {
    0% { background: #fff3cd; }
    50% { background: #ffeaa7; }
    100% { background: #fff3cd; }
}

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

.error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.loading {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Loading Spinner Animation */
.loading-container {
    text-align: center;
    padding: 30px 20px;
    background: #fafbfc;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e1e8ed;
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

.loading-text {
    display: inline-block;
    vertical-align: middle;
    font-weight: 500;
    color: #374151;
    font-size: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#refreshBtn {
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .nav-left h1 {
        font-size: 1.3rem;
    }

    .nav-center {
        width: 100%;
        max-width: none;
    }

    .create-form-inline {
        padding: 12px 15px;
        gap: 8px;
    }

    .create-form-inline input {
        min-width: 150px;
    }

    .create-form-inline button {
        padding: 10px 14px;
        font-size: 13px;
    }

    .container {
        padding: 15px;
    }

    section {
        padding: 15px;
    }

    .file-header {
        flex-direction: column;
        align-items: stretch;
    }

    .file-controls {
        justify-content: space-between;
    }

    .search-input {
        width: 200px;
    }

    #fileTable {
        font-size: 13px;
    }

    #fileTable th,
    #fileTable td {
        padding: 8px 10px;
    }

    .filename-cell,
    .url-cell {
        max-width: 200px;
    }
}

@media (max-width: 600px) {
    .nav-container {
        padding: 10px;
    }

    .create-form-inline {
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .create-form-inline label {
        text-align: left;
        margin-bottom: 4px;
    }

    .create-form-inline input {
        min-width: auto;
        width: 100%;
    }

    .create-form-inline button {
        align-self: flex-end;
        width: auto;
    }

    .container {
        padding: 10px;
    }

    section {
        padding: 12px;
    }

    .tracking-url {
        flex-direction: column;
        align-items: stretch;
    }

    .file-controls {
        flex-direction: column;
        gap: 8px;
    }

    .search-input {
        width: 100%;
    }

    .filename-cell,
    .url-cell {
        max-width: 150px;
    }
}
