/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Header Styles */
header {
    background-color: #004D00;
    color: white;
    padding: 12px 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header .logo img {
    height: 48px;
    width: auto;
}

/* Form Styles */
input, button, select, textarea {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

input:focus, button:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #004D00;
    box-shadow: 0 0 0 2px rgba(0, 77, 0, 0.2);
}

button {
    background-color: #004D00;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #006600;
}

/* Login Page Styles */
.login-body {
    background: linear-gradient(135deg, #004D00, #006600);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px 30px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    text-align: center;
}

.login-box h2 {
    margin-bottom: 30px;
    color: #004D00;
}

.login-form .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.login-form input {
    width: 100%;
}

.login-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.back-link {
    margin-top: 20px;
}

.back-link a {
    color: #004D00;
    text-decoration: none;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Admin Panel Styles */
.admin-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-nav {
    background-color: #004D00;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-brand h2 {
    margin: 0;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: rgba(255,255,255,0.2);
}

.admin-main {
    flex: 1;
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Dashboard Styles */
.dashboard-header {
    margin-bottom: 30px;
}

.dashboard-header h1 {
    color: #004D00;
    margin-bottom: 10px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 30px 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    color: #004D00;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.dashboard-actions {
    margin-bottom: 40px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.action-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #004D00;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    color: #004D00;
}

.action-card h4 {
    margin-bottom: 10px;
    color: #004D00;
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #004D00;
}

.page-header h1 {
    color: #004D00;
    margin-bottom: 5px;
}

/* Messages */
.message {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Forms */
.upload-section,
.search-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.upload-section h2,
.search-section h2 {
    color: #004D00;
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
}

.upload-btn,
.search-btn {
    background-color: #004D00;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
}

.clear-btn {
    background-color: #6c757d;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    margin-left: 10px;
}

.help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Edit Form Styles */
.edit-section {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.edit-section h2 {
    color: #856404;
    margin-bottom: 20px;
}

.save-btn {
    background-color: #28a745;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin-right: 10px;
}

.save-btn:hover {
    background-color: #218838;
}

.cancel-btn {
    background-color: #6c757d;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
}

.cancel-btn:hover {
    background-color: #545b62;
}

.current-file {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 3px;
    border-left: 3px solid #007bff;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #004D00;
}

table tr:hover {
    background-color: #f8f9fa;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    margin-right: 5px;
}

.view-btn {
    background-color: #007bff;
    color: white;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.edit-btn {
    background-color: #ffc107;
    color: #212529;
}

.edit-btn:hover {
    background-color: #e0a800;
}

.download-btn {
    background-color: #28a745;
    color: white;
}

.actions {
    white-space: nowrap;
}

/* Certificate Results */
.search-results {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.certificate-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.certificate-info p {
    margin-bottom: 10px;
}

.certificate-viewer {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.download-section {
    text-align: center;
}

.download-btn {
    background-color: #28a745;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    display: inline-block;
}

/* Profile Results */
.profile-results {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.profile-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    margin-bottom: 30px;
}

.profile-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
}

.info-row {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.info-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-row label {
    min-width: 130px;
    font-weight: bold;
    color: #004D00;
}

.file-link {
    color: #007bff;
    text-decoration: none;
}

.file-link:hover {
    text-decoration: underline;
}

.profile-actions {
    min-width: 200px;
}

.profile-actions h3 {
    color: #004D00;
    margin-bottom: 15px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 10px 16px;
    text-decoration: none;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
}

.certificate-preview {
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.certificate-preview h3 {
    color: #004D00;
    margin-bottom: 15px;
}

.pdf-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

/* No Results */
.no-results,
.welcome,
.search-instructions {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.no-results h2,
.welcome h2,
.search-instructions h2 {
    color: #004D00;
    margin-bottom: 20px;
}

.instructions ul,
.search-tips ul {
    text-align: left;
    display: inline-block;
    margin: 20px 0;
}

.instruction-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.instruction-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #004D00;
}

.instruction-card h4 {
    color: #004D00;
    margin-bottom: 10px;
}

.note {
    color: #666;
    font-style: italic;
    margin-top: 20px;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Footer */
footer {
    background-color: #f5f5f5;
    padding: 20px;
    text-align: center;
    margin-top: 40px;
    border-top: 1px solid #eee;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-nav {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .admin-main {
        padding: 20px 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .action-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-card {
        grid-template-columns: 1fr;
    }
    
    .instruction-cards {
        grid-template-columns: 1fr;
    }
    
    header div {
        flex-direction: column;
        gap: 15px;
    }
    
    header form {
        flex-direction: column;
        width: 100%;
    }
    
    header input {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .upload-section,
    .search-section,
    .search-results,
    .profile-results {
        padding: 20px;
    }
    
    table th,
    table td {
        padding: 8px;
        font-size: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

/* Profile Page Styles */
.profile-sections {
    display: grid;
    gap: 30px;
    max-width: 800px;
}

.profile-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #004D00;
}

.profile-section h2 {
    color: #004D00;
    margin-bottom: 10px;
    font-size: 20px;
}

.section-description {
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

.profile-form {
    max-width: 400px;
}

.profile-form .form-group {
    margin-bottom: 20px;
}

.profile-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

.profile-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.profile-form input:focus {
    outline: none;
    border-color: #004D00;
    box-shadow: 0 0 0 2px rgba(0, 77, 0, 0.1);
}

.readonly-input {
    background-color: #f8f9fa;
    color: #6c757d;
}

.profile-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.username-btn {
    background-color: #007bff;
    color: white;
}

.username-btn:hover {
    background-color: #0056b3;
}

.password-btn {
    background-color: #dc3545;
    color: white;
}

.password-btn:hover {
    background-color: #c82333;
}

@media (max-width: 768px) {
    .profile-sections {
        gap: 20px;
    }
    
    .profile-section {
        padding: 20px;
    }
    
    .profile-form {
        max-width: 100%;
    }
}