/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0077be;
    --primary-dark: #005a8c;
    --secondary-color: #00a8e8;
    --accent-color: #00d4aa;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --bg-dark: #0a1628;
    --bg-card: #132238;
    --bg-card-hover: #1a2d47;
    --text-primary: #ffffff;
    --text-secondary: #a8b2c1;
    --text-muted: #6b7785;
    --border-color: #2a3a50;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-dark) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 32px;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
}

.logo span {
    color: var(--secondary-color);
}

.nav {
    display: flex;
    gap: 10px;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    padding: 30px 0;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--text-primary);
}

.required {
    color: var(--danger-color);
}

.action-buttons {
    margin-bottom: 25px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 119, 190, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-color);
    color: var(--text-primary);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn-icon.danger:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

/* Dive Card (Deepblu-style) */
.dive-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.dive-card:hover {
    transform: translateY(-4px);
}

.dive-card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.freedive-badge {
    display: inline-block;
    background: #0a7c5c;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.dive-info {
    flex: 1;
}

.dive-number {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 5px;
}

.dive-location {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.dive-site {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.dive-date {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--secondary-color);
    text-align: right;
}

.dive-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.stat-item {
    background: var(--bg-card);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dive-card-photos {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    padding: 2px;
    background: var(--border-color);
}

.dive-photo {
    width: 150px;
    height: 100px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: zoom-in;
    transition: opacity 0.15s ease;
}
.dive-photo:hover {
    opacity: 0.85;
}

.dive-card-details {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
}

.dive-card-notes {
    padding: 0 20px 20px;
}

.notes-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(0, 119, 190, 0.1);
    padding: 15px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
}

.dive-card-actions {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Dives Grid */
.dives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.dive-card-mini {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    cursor: pointer;
}

.dive-card-mini:hover {
    transform: translateY(-2px);
    background: var(--bg-card-hover);
}

.dive-card-mini-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.dive-card-mini-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.mini-stat {
    display: flex;
    flex-direction: column;
}

.mini-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
}

.mini-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dive-card-mini-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Certifications Grid */
.certifications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.cert-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.cert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.cert-agency {
    display: inline-block;
    background: var(--primary-color);
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.cert-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.cert-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.cert-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.cert-detail-label {
    color: var(--text-muted);
}

.cert-detail-value {
    color: var(--text-secondary);
}

.cert-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.cert-badge-img {
    display: block;
    max-width: 180px;
    max-height: 140px;
    object-fit: contain;
    margin: 12px auto 4px;
    border-radius: var(--radius-sm);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-small {
    max-width: 400px;
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Forms */
form {
    padding: 25px;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

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

label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

input[type="file"] {
    padding: 10px;
}

small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
}

/* OSM Link */
.osm-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.85rem;
}

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

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .nav {
        justify-content: center;
    }

    .nav-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    .dive-card-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dives-grid,
    .certifications-grid {
        grid-template-columns: 1fr;
    }

    .dive-card-details {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 15px 25px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--accent-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Add these to your existing styles.css */

/* Profile Picture */
.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.profile-pic {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 350px;
    width: 100%;
}

.login-card h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 25px;
}

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

#password-input {
    text-align: center;
    letter-spacing: 5px;
    font-size: 1.2rem;
}

/* Profile Section on Home View */
.profile-section {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 30px;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(0, 119, 190, 0.1) 100%);
    border-radius: var(--radius);
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-color);
    box-shadow: 0 4px 20px rgba(0, 212, 170, 0.3);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-primary), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dive-stats {
    display: flex;
    gap: 25px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.dive-stats span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dive-stats span::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
}

@media (max-width: 768px) {
    .profile-section {
        flex-direction: column;
        text-align: center;
    }

    .profile-photo {
        width: 100px;
        height: 100px;
    }

    .profile-name {
        font-size: 1.5rem;
    }

    .dive-stats {
        justify-content: center;
    }
}

/* Checklists */
.checklist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.checklist-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}