/* Common Styles for Interactive Map Application */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --primary-color: #007cba;
    --primary-hover: #005a87;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --danger-color: #dc3545;
    --danger-hover: #c82333;
    --success-color: #28a745;
    --success-bg: #d4edda;
    --success-border: #c3e6cb;
    --success-text: #155724;
    --error-bg: #f8d7da;
    --error-border: #f5c6cb;
    --error-text: #721c24;
    --border-color: #ccc;
    --border-radius: 4px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --box-shadow-lg: 0 4px 20px rgba(0,0,0,0.3);
    --transition: 0.3s;
    --bg-light: #f9f9f9;
    --bg-white: #fff;
    --text-primary: #333;
    --text-secondary: #666;
    --text-disabled: #bbb;
}

/* ===== RESET & BASE ===== */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: var(--bg-light);
}

.container {
    max-width: 600px;
    width: 90%;
    margin: 0 auto;
    padding: 30px 20px;
}

/* ===== BUTTONS ===== */
.btn {
    text-decoration: none;
    padding: 10px 15px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background var(--transition), opacity var(--transition);
    display: inline-block;
}

.btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
}

.btn-popup {
    padding: 5px 10px;
    font-size: 12px;
    color: white;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: var(--bg-white);
    margin: 15% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--box-shadow-lg);
}

.modal h3 {
    margin-top: 0;
    color: var(--text-primary);
}

.modal button {
    margin: 5px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    padding: 12px;
    margin: 5px 0 15px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-sizing: border-box;
    font-size: 16px;
    font-family: Arial, sans-serif;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ===== MESSAGES / ALERTS ===== */
.message {
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: none;
    font-size: 14px;
}

.message.active {
    display: block;
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

/* ===== LOADING ===== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: none;
    text-align: center;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.loading.active {
    display: block;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    flex: 1;
    padding: 10px;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: bold;
}

.tab:hover {
    color: var(--primary-color);
}

/* ===== DIVIDER ===== */
.divider {
    margin: 20px 0;
    text-align: center;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #e0e0e0;
}

.divider span {
    background: var(--bg-white);
    padding: 0 10px;
    position: relative;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== IMAGE UPLOAD & PREVIEW ===== */
.image-upload-section {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

.image-upload-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.image-preview {
    margin-top: 10px;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===== LOCATION DETAILS PAGE ===== */
.detail {
    margin-bottom: 15px;
}

.detail strong {
    color: var(--primary-color);
}

.detail a {
    color: var(--primary-color);
    text-decoration: none;
}

.detail a:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

.location-image {
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    text-align: center;
}

.location-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.location-image .no-image,
.current-image .no-image {
    color: #999;
    font-style: italic;
    padding: 10px;
}

/* ===== VOTING BUTTONS ===== */
.voting-section {
    margin: 25px 0;
    padding: 20px;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.voting-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: 18px;
}

.vote-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.vote-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 20px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.vote-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.vote-btn:active:not(:disabled) {
    transform: translateY(0);
}

.vote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Upvote button styles */
.upvote-btn {
    border-color: #28a745;
}

.upvote-btn:hover:not(:disabled):not(.voted) {
    background: #e8f5e9;
    border-color: #1e7e34;
}

.upvote-btn.voted {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

/* Downvote button styles */
.downvote-btn {
    border-color: #dc3545;
}

.downvote-btn:hover:not(:disabled):not(.voted) {
    background: #ffebee;
    border-color: #bd2130;
}

.downvote-btn.voted {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.vote-icon {
    font-size: 24px;
    line-height: 1;
}

.vote-count {
    font-size: 16px;
    font-weight: bold;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--box-shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.form-container {
    display: none;
}

.form-container.active {
    display: block;
}

.form-button,
.google-btn {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background var(--transition);
}

.form-button:hover,
.google-btn:hover {
    background: #f5f5f5;
}

.forgot-password {
    text-align: right;
    margin-top: 5px;
}

.forgot-password a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.forgot-password a:hover {
    text-decoration: underline;
}

/* ===== PROFILE & SETTINGS PAGE ===== */
.profile-card {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.profile-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.profile-picture-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 20px auto;
}

.profile-icon {
    width: 120px;
    height: 120px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    overflow: hidden;
    border: 4px solid #f0f0f0;
}

.profile-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.change-picture-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--bg-white);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background var(--transition);
}

.change-picture-btn:hover {
    background: var(--primary-hover);
}

.picture-upload-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    display: none;
}

.picture-upload-section.active {
    display: block;
}

.picture-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 10px auto;
    display: none;
    border: 3px solid var(--primary-color);
}

.picture-preview.active {
    display: block;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
    margin: 10px 0;
}

.file-input-wrapper input[type=file] {
    position: absolute;
    left: -9999px;
}

.file-input-label {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    transition: background var(--transition);
}

.file-input-label:hover {
    background: var(--primary-hover);
}

.upload-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.upload-actions button {
    flex: 1;
    padding: 8px 15px;
    font-size: 14px;
}

.email-verification-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 12px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    font-size: 14px;
}

.username-display {
    font-size: 24px;
    color: var(--text-primary);
    font-weight: bold;
    margin: 0;
}

.email-display {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 5px 0 0 0;
}

.email-verified {
    display: inline-block;
    background: var(--success-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 5px;
}

.email-unverified {
    display: inline-block;
    background: #ffc107;
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 5px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 20px;
    transition: all var(--transition) ease;
    border: 2px solid transparent;
}

.social-link:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.social-media-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.social-media-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 16px;
}

.social-input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.btn-container {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn-container .btn {
    flex: 1;
}

.logout-section {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    text-align: center;
    margin-bottom: 20px;
}

.logout-section p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.stats-section {
    background: var(--bg-white);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
}

.stats-section h3 {
    margin-top: 0;
    color: var(--text-primary);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--primary-color);
    font-weight: bold;
}

.read-only-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.read-only-info .info-label {
    font-weight: bold;
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

.read-only-info .info-value {
    color: var(--text-primary);
    word-wrap: break-word;
}

/* ===== MAP PAGE SPECIFIC ===== */
.popup-actions {
    margin-top: 10px;
    display: flex;
    gap: 5px;
}

.current-image {
    margin: 10px 0;
    text-align: center;
}

.current-image img {
    max-width: 100%;
    max-height: 150px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.popup-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: var(--border-radius);
    margin: 10px 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }
    
    .modal-content {
        margin: 10% auto;
        padding: 15px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="file"],
    textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .profile-card {
        padding: 20px;
    }
    
    .btn-container {
        flex-direction: column;
    }
    
    .login-container {
        padding: 30px 20px;
    }
}
