/* ============================================
   Guestbook Stylesheet
   ============================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 40px 20px;
    color: #333;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

header .subtitle {
    font-size: 1em;
    opacity: 0.9;
}

.alert {
    padding: 15px 20px;
    margin: 20px 30px;
    border-radius: 8px;
    font-size: 0.95em;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.guestbook-form {
    padding: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

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

.form-row .form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.required {
    color: #e74c3c;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.char-count {
    text-align: right;
    font-size: 0.85em;
    color: #999;
    margin-top: 5px;
}

.captcha-group {
    margin-bottom: 25px;
}

.captcha-container {
    display: flex;
    gap: 15px;
    align-items: center;
}

.captcha-container img {
    height: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    background: #f5f5f5;
}

.captcha-container input {
    flex: 1;
}

.captcha-hint {
    font-size: 0.85em;
    color: #999;
    margin-top: 8px;
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
    padding: 6px 15px;
    font-size: 0.85em;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
}

footer {
    background: #f8f9fa;
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #eee;
    font-size: 0.9em;
    color: #999;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Admin Panel Styles
   ============================================ */

.admin-container {
    max-width: 1100px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #2c3e50;
    color: #fff;
}

.admin-header h1 {
    font-size: 1.5em;
}

.admin-nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

.admin-nav a {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 0.9em;
}

.admin-nav a:hover {
    color: #3498db;
}

.admin-nav .welcome {
    font-size: 0.9em;
    color: #bdc3c7;
}

.admin-content {
    padding: 30px;
}

.stats-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    flex: 1;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #667eea;
}

.stat-card .stat-number {
    font-size: 2em;
    font-weight: 700;
    color: #667eea;
}

.stat-card .stat-label {
    font-size: 0.9em;
    color: #999;
    margin-top: 5px;
}

.search-bar {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95em;
}

.search-bar button {
    padding: 10px 20px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.messages-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.messages-table th {
    background: #2c3e50;
    color: #fff;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
}

.messages-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
    vertical-align: top;
}

.messages-table tr:hover {
    background: #f8f9fa;
}

.messages-table .message-cell {
    max-width: 300px;
}

.messages-table .message-preview {
    color: #666;
    line-height: 1.5;
}

.messages-table .actions {
    white-space: nowrap;
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-weight: 500;
}

.action-btn-view {
    background: #3498db;
    color: #fff;
}

.action-btn-view:hover {
    background: #2980b9;
}

.action-btn-copy {
    background: #27ae60;
    color: #fff;
}

.action-btn-copy:hover {
    background: #229954;
}

.action-btn-delete {
    background: #e74c3c;
    color: #fff;
}

.action-btn-delete:hover {
    background: #c0392b;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 25px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #666;
    font-size: 0.9em;
}

.pagination a:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .current {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* ============================================
   Login Page Styles
   ============================================ */

.login-container {
    max-width: 420px;
    margin: 80px auto;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #fff;
    font-size: 2em;
    margin-bottom: 10px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.8);
}

.login-form {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.login-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 1.05em;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

.login-footer a {
    color: #fff;
    text-decoration: none;
}

/* ============================================
   Modal Styles
   ============================================ */

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

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.3em;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    text-align: right;
}

.detail-row {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-label {
    font-weight: 600;
    color: #555;
    width: 100px;
    flex-shrink: 0;
}

.detail-value {
    color: #333;
    flex: 1;
    word-break: break-all;
}

.detail-value.message-content {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 600px) {
    body {
        padding: 20px 10px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-row .form-group {
        margin-bottom: 20px;
    }
    
    .captcha-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .captcha-container input {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .stats-bar {
        flex-direction: column;
    }
    
    .messages-table {
        font-size: 0.85em;
    }
    
    .messages-table th,
    .messages-table td {
        padding: 8px 10px;
    }
}
