/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 16px;
    color: #333;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.container-narrow {
    max-width: 900px;
}

/* Typography */
h1, h2, h3 {
    color: #1a202c;
    margin-bottom: 16px;
}

h1 {
    font-size: clamp(24px, 5vw, 32px);
    text-align: center;
    color: #4c51bf;
    margin-bottom: 32px;
}

h2 {
    font-size: clamp(18px, 4vw, 24px);
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 14px;
}

input[type="text"],
input[type="file"],
input[type="search"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: #4c51bf;
    box-shadow: 0 0 0 3px rgba(76, 81, 191, 0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: #4c51bf;
    color: white;
}

.btn-primary:hover {
    background: #434190;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 81, 191, 0.4);
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Cards */
.card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 12px;
}

.card-meta {
    color: #718096;
    font-size: 14px;
    margin-bottom: 16px;
}

.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: #4c51bf;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 14px;
}

tr:hover {
    background: #f7fafc;
}

/* Search Bar */
.search-container {
    margin-bottom: 24px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #c6f6d5;
    color: #22543d;
    border-left: 4px solid #48bb78;
}

.alert-error {
    background: #fed7d7;
    color: #742a2a;
    border-left: 4px solid #f56565;
}

.alert-info {
    background: #bee3f8;
    color: #2c5282;
    border-left: 4px solid #4299e1;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.header-title {
    margin: 0;
}

/* PDF Viewer */
.pdf-container {
    margin-top: 24px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

iframe {
    width: 100%;
    height: 600px;
    border: none;
}

/* Search Results */
.search-results {
    margin-top: 24px;
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
}

.search-result-item {
    padding: 12px;
    background: white;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 3px solid #4c51bf;
}

.search-result-item mark {
    background: #faf089;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4c51bf;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #edf2f7;
    color: #4a5568;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }
    
    .container {
        padding: 16px;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .card-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 20px;
    }
    
    .container {
        padding: 12px;
    }
    
    iframe {
        height: 400px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }