/* --- Global Styles & Variables --- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --border-color: #dee2e6;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

html[data-theme='dark'] {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #e9e9e9;
    --border-color: #333;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hidden {
    display: none !important;
}

/* --- Header & Navigation --- */
header {
    background-color: var(--surface-color);
    box-shadow: var(--box-shadow);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover, nav a.active {
    color: var(--primary-color);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-tools button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-tools button:hover {
    background-color: rgba(0,0,0,0.1);
}
html[data-theme='dark'] .header-tools button:hover {
    background-color: rgba(255,255,255,0.1);
}
.header-tools img {
    width: 24px;
    height: 24px;
}

/* --- Main Content & Cards --- */
main {
    padding: 2rem 0;
}

.card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

#hero {
    text-align: center;
    margin-bottom: 2rem;
}

#hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

#hero p {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

/* --- Uploader & Drag-Drop --- */
#drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
}

#drop-zone.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

#drop-zone p {
    margin: 1rem 0;
}

/* --- Editor Interface --- */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.image-preview-container {
    width: 100%;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

#image-preview {
    width: 100%;
    height: auto;
    display: block;
}

.exif-display {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.exif-display strong {
    color: var(--primary-color);
}

/* --- Forms & Controls --- */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 1rem;
}

.gps-group {
    display: flex;
    gap: 1rem;
}

/* --- Buttons --- */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: background-color 0.2s, opacity 0.2s;
    width: 100%;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background-color: #0056b3;
}
.btn-primary:disabled {
    background-color: var(--secondary-color);
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}
.btn-secondary:hover {
    background-color: #5a6268;
}

/* --- Loader --- */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    nav { display: none; } /* Simple solution for mobile, can be replaced with a burger menu */
    .logo { font-size: 1.2rem; }
    #hero h1 { font-size: 2rem; }
    .card { padding: 1.5rem; }
}

/* RTL Support */
html[dir="rtl"] {
    text-align: right;
}
html[dir="rtl"] nav ul {
    gap: 1.5rem;
}
html[dir="rtl"] .header-tools {
    gap: 1rem;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn.btn-danger:hover {
    background-color: #c82333;
}

.btn.btn-danger:disabled {
    background-color: #bd8288;
    cursor: not-allowed;
}

.exif-display {
    max-height: 300px; /* زيادة الارتفاع لعرض بيانات أكثر */
}